Hi all,
I am having some trouble getting video to record. Every time I call
prepare(), I get a IOException with an error message "prepare failed".
Any help would be great.
thanks,
Hamy
public class Test extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MediaRecorder recorder = new MediaRecorder();
try {
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setVideoSize(176, 144); // QCIF
recorder.setVideoFrameRate(10);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
FileOutputStream fs = openFileOutput("test",
Context.MODE_PRIVATE);
recorder.setOutputFile(fs.getFD());
recorder.prepare();
recorder.start();
for (int i = 0; i < 10000; i++)
;
recorder.stop();
recorder.reset(); // You can reuse the object by going
back to
//
setAudioSource() step
recorder.release(); // Now the object cannot be reused
} catch (Exception e) {
Log.v("asd", "Bad stuff happened");
}
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---