MediaRecorder`s Exception!help me.


Last Updated:

  1. tommylion

    tommylion New Member This Topic's Starter

    Joined:
    Aug 6, 2009
    Messages:
    3
    Likes Received:
    0
    I use MediaRecorder to record the sound.I writed source is belows:

    ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
    recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    // recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

    try {
    recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
    // recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    recorder.setOutputFile(Environment
    .getExternalStorageDirectory().getAbsolutePath()
    + "/test.mp4");
    recorder.prepare();
    recorder.start();
    } catch (IOException e) {
    e.printStackTrace();
    Toast.makeText(CaptureVideoDemo.this, e.toString(),
    Toast.LENGTH_LONG).show();
    recorder = new MediaRecorder();
    } catch (Exception e) {
    e.printStackTrace();
    Toast.makeText(CaptureVideoDemo.this, e.toString(),
    Toast.LENGTH_LONG).show();
    recorder = new MediaRecorder();
    }
    ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
    when I test the source by emulator,
    the exception is belows,please tell me what the wrong.

    ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
    08-07 02:38:08.261: DEBUG/CameraService(556): Connect E from ICameraClient 0x157b4
    08-07 02:38:08.271: DEBUG/CameraService(556): Client E constructor
    08-07 02:38:08.281: DEBUG/CameraHardwareStub(556): initHeapLocked: preview size=176x144
    08-07 02:38:08.301: ERROR/MediaPlayer(556): Unable to to create media player
    08-07 02:38:08.310: ERROR/CameraService(556): Failed to load CameraService sounds.
    08-07 02:38:08.321: ERROR/MediaPlayer(556): Unable to to create media player
    08-07 02:38:08.331: ERROR/CameraService(556): Failed to load CameraService sounds.
    08-07 02:38:08.331: DEBUG/CameraService(556): Client X constructor
    08-07 02:38:08.340: DEBUG/CameraService(556): Connect X
    08-07 02:38:08.340: ERROR/CameraInput(556): No surface is available for display
    08-07 02:38:08.350: ERROR/MediaRecorder(751): prepare failed: -2147483648
    08-07 02:38:08.350: WARN/System.err(751): java.io.IOException: prepare failed.
    08-07 02:38:08.391: WARN/System.err(751): at android.media.MediaRecorder._prepare(Native Method)
    08-07 02:38:08.401: WARN/System.err(751): at android.media.MediaRecorder.prepare(MediaRecorder.java:375)
    08-07 02:38:08.401: WARN/System.err(751): at com.example.android.apis.media.CaptureVideoDemo$1.onClick(CaptureVideoDemo.java:124)
    08-07 02:38:08.411: WARN/System.err(751): at android.view.View.performClick(View.java:2179)
    08-07 02:38:08.411: WARN/System.err(751): at android.view.View.onKeyUp(View.java:3634)
    08-07 02:38:08.430: WARN/System.err(751): at android.widget.TextView.onKeyUp(TextView.java:4233)
    08-07 02:38:08.430: WARN/System.err(751): at android.view.KeyEvent.dispatch(KeyEvent.java:895)
    08-07 02:38:08.440: WARN/System.err(751): at android.view.View.dispatchKeyEvent(View.java:3343)
    08-07 02:38:08.440: WARN/System.err(751): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:727)
    08-07 02:38:08.451: WARN/System.err(751): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:727)
    08-07 02:38:08.460: WARN/System.err(751): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:727)
    08-07 02:38:08.460: WARN/System.err(751): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:727)
    08-07 02:38:08.460: WARN/System.err(751): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1703)
    08-07 02:38:08.472: WARN/System.err(751): at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1192)
    08-07 02:38:08.472: WARN/System.err(751): at android.app.Activity.dispatchKeyEvent(Activity.java:1973)
    08-07 02:38:08.481: WARN/System.err(751): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1679)
    08-07 02:38:08.491: WARN/System.err(751): at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2188)
    08-07 02:38:08.491: WARN/System.err(751): at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2158)
    08-07 02:38:08.501: WARN/System.err(751): at android.view.ViewRoot.handleMessage(ViewRoot.java:1490)
    08-07 02:38:08.501: WARN/System.err(751): at android.os.Handler.dispatchMessage(Handler.java:99)
    08-07 02:38:08.501: WARN/System.err(751): at android.os.Looper.loop(Looper.java:123)
    08-07 02:38:08.501: WARN/System.err(751): at android.app.ActivityThread.main(ActivityThread.java:3948)
    08-07 02:38:08.501: WARN/System.err(751): at java.lang.reflect.Method.invokeNative(Native Method)
    08-07 02:38:08.501: WARN/System.err(751): at java.lang.reflect.Method.invoke(Method.java:521)
    08-07 02:38:08.501: WARN/System.err(751): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
    08-07 02:38:08.501: WARN/System.err(751): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
    08-07 02:38:08.501: WARN/System.err(751): at dalvik.system.NativeStart.main(Native Method)
    08-07 02:38:08.520: INFO/NotificationService(585): enqueueToast pkg=com.example.android.apis callback=android.app.ITransientNotification$Stub$Proxy@437469b8 duration=1
    ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
     

    Advertisement

Share This Page

Loading...