Hi
i've same problem with camera video recording
below my source code:
private boolean mediaRecorderConfig()
{
try
{
mediaRecorder = new MediaRecorder();
mediaRecorder.setCamera(mCamera);
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediaRecorder.setMaxDuration(maxDurationInMs);
mediaRecorder.setOutputFile("/sdcard/
myvideo.mp4");
mediaRecorder.setVideoFrameRate(videoFramesPerSecond);
mediaRecorder.setVideoSize(mSurfaceView.getWidth(),
mSurfaceView.getHeight());
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
mediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
mediaRecorder.setMaxFileSize(maxFileSizeInBytes);
mediaRecorder.prepare();
}
catch (IOException e)
{
Log.e(TAG,e.getMessage());
e.printStackTrace();
return false;
}
return true;
}
private boolean startRecording()
{
try
{
mCamera.unlock();
if(!mediaRecorderConfig())
return false;
mediaRecorder.start();
recording = true;
return true;
}
catch (IllegalStateException e)
{
Log.e(TAG,e.getMessage());
e.printStackTrace();
return false;
}
}
private void stopRecording()
{
if(mediaRecorder != null)
mediaRecorder.stop();
if(mCamera != null)
mCamera.lock();
recording = false;
}
i have my problem when I execute:
mediaRecorder.start(); or mediaRecorder.stop();
I receive this cat log:
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): FATAL EXCEPTION: main
08-11 20:23:42.832: ERROR/AndroidRuntime(4661):
java.lang.RuntimeException: start failed.
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
android.media.MediaRecorder.start(Native Method)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
it.android.TrackRace.ViewCamera.startRecording(ViewCamera.java:323)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
it.android.TrackRace.ViewCamera.onOptionsItemSelected(ViewCamera.java:
205)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
android.app.Activity.onMenuItemSelected(Activity.java:2205)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:
748)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:
143)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:
855)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:
532)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:
122)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
android.view.View$PerformClick.run(View.java:9080)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
android.os.Handler.handleCallback(Handler.java:587)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
android.os.Handler.dispatchMessage(Handler.java:92)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
android.os.Looper.loop(Looper.java:130)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
android.app.ActivityThread.main(ActivityThread.java:3683)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
java.lang.reflect.Method.invokeNative(Native Method)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
java.lang.reflect.Method.invoke(Method.java:507)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-11 20:23:42.832: ERROR/AndroidRuntime(4661): at
dalvik.system.NativeStart.main(Native Method)
can somebody help me to resolve this problem?
thank you very much
Simone
--
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