Error Handling: android. media. MediaRecorder. start (Native Method) Error

Source: Internet
Author: User


Spydroid-error reported in android4.0 during android Testing
start failed: -19

And also found that,

01-06 14:04:07.790: V/MediaRecorder(13280): prepare01-06 14:04:07.790: V/IMediaRecorder(13280): prepare01-06 14:04:07.800: V/MediaRecorder(13280): start01-06 14:04:07.800: V/IMediaRecorder(13280): start01-06 14:04:08.190: E/MediaRecorder(13280): start failed: -1901-06 14:04:08.190: W/System.err(13280): java.lang.RuntimeException: start failed.01-06 14:04:08.200: W/System.err(13280): at android.media.MediaRecorder.start(Native Method)01-06 14:04:08.200: W/System.err(13280): at com.yousee.videocapturedemo.VideoCapturePlus$2.onClick(VideoCapturePlus.java:145)01-06 14:04:08.200: W/System.err(13280): at android.view.View.performClick(View.java:3515)01-06 14:04:08.200: W/System.err(13280): at android.view.View$PerformClick.run(View.java:14144)01-06 14:04:08.200: W/System.err(13280): at android.os.Handler.handleCallback(Handler.java:605)01-06 14:04:08.200: W/System.err(13280): at android.os.Handler.dispatchMessage(Handler.java:92)01-06 14:04:08.200: W/System.err(13280): at android.os.Looper.loop(Looper.java:148)01-06 14:04:08.200: W/System.err(13280): at android.app.ActivityThread.main(ActivityThread.java:4503)01-06 14:04:08.200: W/System.err(13280): at java.lang.reflect.Method.invokeNative(Native Method)01-06 14:04:08.200: W/System.err(13280): at java.lang.reflect.Method.invoke(Method.java:511)01-06 14:04:08.200: W/System.err(13280): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:830)01-06 14:04:08.200: W/System.err(13280): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)01-06 14:04:08.200: W/System.err(13280): at dalvik.system.NativeStart.main(Native Method)



..... MMediaRecorder = new MediaRecorder (); // sets the video source mMediaRecorder. setVideoSource (MediaRecorder. videoSource. DEFAULT); // set the audio source mMediaRecorder. setAudioSource (MediaRecorder. audioSource. DEFAULT); // set the file output format to mMediaRecorder. setOutputFormat (MediaRecorder. outputFormat. THREE_GPP); // sets the video encoding method (mMediaRecorder. setVideoEncoder (MediaRecorder. videoEncoder. h264); // sets the audio encoding method mMediaRecorder. setAudioEncoder (MediaRecorder. audioEncoder. DEFAULT); // set the video height and width. Note the instructions in this document: // Must be called after setVideoSource (). // Call this after setOutFormat () but before prepare (). // set the Frame Rate of the recorded video. Note the instructions in this document: // Must be called after setVideoSource (). // Call this after setOutFormat () but before prepare (). mMediaRecorder. setVideoFrameRate (20); // sets the mMediaRecorder of the preview image. setPreviewDisplay (mSurfaceHolder. getSurface (); // set the output path to mMediaRecorder. setOutputFile (Environment. getExternalStorageDirectory () + File. separator + System. currentTimeMillis () + ". mp4 ");..... mediaRecorder. prepare (); mediaRecorder. start ();.....
 

The same program runs normally on the Android2.3 platform and reports an error on Android4.0.

Solution:

Comment out the statement for setting the video frame rate. // MMediaRecorder. setVideoFrameRate (mQuality. framerate );


After you remove setVideoFrameRate, you can set

MMediaRecorder. setVideoSize (videoWidth, videoHeight );

Refer:

Http://stackoverflow.com/questions/11249642/mediarecorder-start-failed-19



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.