when i add video source and video encoder, it gives error in
recoreder.prepare while the same code is working for audio.
i am not finding what i am doing wrong.

setContentView(R.layout.camera);
preview=(SurfaceView)findViewById(R.id.surface);
previewHolder=preview.getHolder();
previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
recorder = new MediaRecorder();
String url = "/sdcard/dcim/test/3gp";
camera = Camera.open();
Camera.Parameters parameters = camera.getParameters();
parameters.setPreviewSize(352, 288);
parameters.set("orientation", "portrait");
camera.setParameters(parameters);
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setOutputFile(url);
recorder.setVideoFrameRate(15);
recorder.setVideoSize(480, 320);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
recorder.prepare();
recorder.start();
Thread.sleep(100000);
recorder.stop();
recorder.release();

} catch (Exception e) {
e.getMessage();
}



On Nov 18, 9:11 pm, "Roman ( T-Mobile USA)" <roman.baumgaert...@t-
mobile.com> wrote:
> It might be helpful to attach your code.
>
> Have you called the prepare() method before starting the recording?
>
> --
> Roman Baumgaertner
> Sr. SW Engineer-OSDC
> ·T· · ·Mobile· stick together
> The views, opinions and statements in this email are those of the
> author solely in their individual capacity, and do not necessarily
> represent those of T-Mobile USA, Inc.
>
> On Nov 17, 5:55 am,android_dev<pankaj.i...@gmail.com> wrote:
>
> > Hi
> > i am trying to record video and upload to web server. i created a temp
> > file  but when i try to startrecorder.start(), it gives me
> > "java.lang.RuntimeException: start failed." i tried debugging it but i
> > am not getting it working. can someone please give me sample code to
> > record video and save. i am really stuck with this error

-- 
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