Sunday, March 2, 2014

-19 Error: start failed to call MediaRecorder occurs when the start video recording ()


Substantially in accordance with the code of Android Camera wrote when performing start () The myVideoRecorder.start occurs () as shown in the title of the error, the error is to ask how to produce, how to modify? Code is as follows:

 
private void start () {
if (isRecording)
{
/ / Stop recording and release myFrontFacingCamera
myVideoRecorder.stop ();
releaseVideoRecorder ();
/ * MyFrontFacingCamera.lock (); * / / / From Android4.0 beginning, this method is automatically called by the system

/ / TODO: notify the user of the video is stopped, set the stop button is unavailable

isRecording = false;
} Else {
/ / Initialize myFrontFacingCamera
if (prepareVideoRecorder ()) {
/ / MyFrontFacingCamera already available and unlocked, VideoRecorder ready
/ / Now you can start recording
/ * MyFrontFacingCamera.startPreview (); * /
myVideoRecorder.start ();

/ / TODO: notify the user of the video has started, set the Start button is unavailable

isRecording = true;
} Else {
/ / Prepare failed to complete, the release myFrontFacingCamera
releaseVideoRecorder ();
/ / TODO: notify the user
}
}
}

private boolean prepareVideoRecorder ()
{
/ * MyFrontFacingCamera = getFrontFacingCamera (); * / / / in onCreate () object has been created myFrontFacingCamera
myVideoRecorder = new MediaRecorder ();

/ / Unlock and camera pointing myVideoRecorder
/ * MyFrontFacingCamera.unlock (); * / / / This method is invoked automatically by the system after Android4.0
myVideoRecorder.setCamera (myFrontFacingCamera);

/ / TODO: Specify the source, if the sound source is not, as a sound source with Mike
myVideoRecorder.setAudioSource (MediaRecorder.AudioSource.CAMCORDER);
myVideoRecorder.setVideoSource (MediaRecorder.VideoSource.CAMERA);

/ / Specify CamcorderProfile (requires API Level 8 or higher), where the Profile includes the output format, audio and video encoding type encoding type
myVideoRecorder.setProfile (CamcorderProfile.get (CamcorderProfile.QUALITY_LOW));

/ * MyVideoRecorder.setVideoSize (100, 100); * /

/ / Specify the output file
myVideoRecorder.setOutputFile (getOutputMediaFile (MEDIA_TYPE_VIDEO) toString ().);

/ / Specify the preview output
myVideoRecorder.setPreviewDisplay (myVideoPreview.getHolder () getSurface ().);

/ / Prepare myVideoRecorder
According to the above configurationtry {
myVideoRecorder.prepare ();
} Catch (IllegalStateException e) {
Log.d ("VideoActivity: prepareVideoRecorder", + "\ n" + e.getMessage () "IllegalStateException error occurred while preparing myVideoRecorder");
releaseVideoRecorder ();
return false;
} Catch (IOException e) {
Log.d ("VideoActivity: prepareVideoRecorder", + "\ n" + e.getMessage () "IOException error occurred while preparing myVideoRecorder");
releaseVideoRecorder ();
return false;
}

return true;



}

<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Specific error message Log hair up look
Reply:
cited a floor reply:
specific error message Log hair up look


05-25 10:10:06.901: I / Process (24747): Sending signal PID:. 24747 SIG: 9
05-25 10:10:12.370: D / libEGL (24832): loaded / system / lib / egl / libGLES_android.so
05-25 10:10:12.378: D / libEGL (24832): loaded / vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
05-25 10:10:12.394: D / libEGL (24832): loaded / vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
05-25 10:10:12.394: D / libEGL (24832): loaded / vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
05-25 10:10:12.479: D / OpenGLRenderer (24832): Enabling debug mode 0
05-25 10:10:17.698: I / MediaRecorderJNI (24832): prepare: surface = 0x6cbc00 (identity = 1766)
05-25 10:10:17.706: E / MediaRecorder (24832): start failed: -19
05-25 10:10:17.729: D / AndroidRuntime (24832): Shutting down VM
05-25 10:10:17.729: W / dalvikvm (24832): threadid = 1: thread exiting with uncaught exception (group = 0x40a8a1f8)
05-25 10:10:17.729: E / AndroidRuntime (24832): FATAL EXCEPTION: main
05-25 10:10:17.729: E / AndroidRuntime (24832): java.lang.RuntimeException: start failed
.05-25 10:10:17.729: E / AndroidRuntime (24832): at android.media.MediaRecorder.start (Native Method)
05-25 10:10:17.729: E / AndroidRuntime (24832): at video .. VideoActivity.start (VideoActivity.java: 195)
05-25 10:10:17.729: E / AndroidRuntime (24832): at video .. VideoActivity.access $ 0 (VideoActivity.java: 178)
05-25 10:10:17.729: E / AndroidRuntime (24832): at video .. VideoActivity $ 1.onClick (VideoActivity.java: 92)
05-25 10:10:17.729: E / AndroidRuntime (24832): at android.view.View.performClick (View.java: 3519)
05-25 10:10:17.729: E / AndroidRuntime (24832): at android.view.View $ PerformClick.run (View.java: 14140)
05-25 10:10:17.729: E / AndroidRuntime (24832): at android.os.Handler.handleCallback (Handler.java: 605)
05-25 10:10:17.729: E / AndroidRuntime (24832): at android.os.Handler.dispatchMessage (Handler.java: 92)
05-25 10:10:17.729: E / AndroidRuntime (24832): at android.os.Looper.loop (Looper.java: 137)
05-25 10:10:17.729: E / AndroidRuntime (24832): at android.app.ActivityThread.main (ActivityThread.java: 4424)
05-25 10:10:17.729: E / AndroidRuntime (24832): at java.lang.reflect.Method.invokeNative (Native Method)
05-25 10:10:17.729: E / AndroidRuntime (24832): at java.lang.reflect.Method.invoke (Method.java: 511)
05-25 10:10:17.729: E / AndroidRuntime (24832): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java: 786)
05-25 10:10:17.729: E / AndroidRuntime (24832): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java: 553)
05-25 10:10:17.729: E / AndroidRuntime (24832): at dalvik.system.NativeStart.main (Native Method
Reply:
Their top one
Reply:
myVideoRecorder.setAudioSource (MediaRecorder.AudioSource.CAMCORDER);
Directly with the default input device it? You did not see the audio path open to print, the print driver to see what's wrong yet? You can also try mms which has a recording function is not normal, you can go to troubleshoot the hardware and driver area.
Reply:
Big Brother did not solve the problem, I have encountered
Reply:
Rub a lot of people that encounter this problem. . The emergence of this problem on my 2.1 to 4.0 on the test developed
Reply:
I have this problem, the development environment 2.2, 4.0 debugging real machine, is the problem, how to solve Oh, please, Daniel
Reply:
The myVideoRecorder.start () and myVideoRecorder.prepare () in the same try catch, I can solve
Reply:
Question should be here: threadid = 1: thread exiting with uncaught exception (group = 0x40a8a1f8)

In mMediaRecorder.start () before adding:
mMediaRecorder.setOnInfoListener (this);
mMediaRecorder.setOnErrorListener (this);

Activity is mainly to achieve OnInfoListener and OnErrorListener Interface
Reply:
Ah did not solve this problem on 4.0
Reply:
Finally, ask the landlord how to solve this problem it?
Reply:
I am also a development environment 2.2, 4.0 debugging real machine, is the problem! ! Will solve it? ?
Reply:
I also encountered depressed for a few days the results are not yet
Reply:
Comment video sound are normal
Reply:
The landlord did not solve this problem I have encountered!
Reply:
I rub I have encountered this problem, you big God what are the solutions ah.
Reply:
Seemingly must first turn off the camera camera.stopPreview ();
camera.release ();
camera = null;
I am very reluctant to turn off the camera, I took note of the code, the results appeared landlord. Uncomment enough.
Reply:
My question is the same, but, when I tested some machine line, not some machine, are MediaRecorder.start (); being given this place, seeking solutions ah ~

No comments:

Post a Comment