Hi,

Does anyone know how to use the MediaRecorder to API to capture video?

I am writing an application where I want to be able to capture video. I am
trying to use the MediaRecorder API in 1.5, which is supposed to support
video capture. However, there are no examples in the documentation on how to
use this API for video (only for audio, and that works perfect). Basically
what I do is the following:

final MediaRecorder recorder = new MediaRecorder();
final String filePath;

....

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
recorder.setOutputFile(filePath);
recorder.prepare();
recorder.start();

This gives me the following error:
E/CameraInput(   37): No surface is available for display
E/MediaRecorder( 7609): prepare failed: -2147483648

OK, so I have to have a surface to preview the video? Could be useful I
guess, but not something I really need.

Could I use the VideoView widget for this, or is that only for playback?

Or am I supposed to use a SurfaceView to preview the video? I saw someone
use that to capture images, but they used android.hardware.Camera to open
the camera and capture a frame, and did not use MediaRecorder.

Does anyone have any idea on how to capture video, or even better have some
example code?

Thanks,
Anders

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to