Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
627 views
in Technique[技术] by (71.8m points)

android - Mediarecorder start failed -19

I am getting this error when running start() for mediarecorder.

06-28 18:46:22.570: E/MediaRecorder(9540): start failed: -19
06-28 18:46:22.570: W/System.err(9540): java.lang.RuntimeException: start failed.

I am extending mediarecorder class
My code:

camera = Camera.open(cameraId);
super.setCamera(camera);
        super.setVideoSource(MediaRecorder.VideoSource.CAMERA);
        super.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
        if (mode==MODE_DEFAULT) {
            super.setMaxDuration(1000);
            super.setMaxFileSize(Integer.MAX_VALUE);
        } else {
            // On some phones a RuntimeException might be thrown :/
            try {
                super.setMaxDuration(0);
                super.setMaxFileSize(Integer.MAX_VALUE); 
            } catch (RuntimeException e) {
                Log.e(TAG,"setMaxDuration or setMaxFileSize failed !");
            }
        }
        super.setVideoEncoder(videoEncoder);
        if(surfaceHolder!=null)
        super.setPreviewDisplay(surfaceHolder.getSurface());
        //super.setVideoSize(quality.resX,quality.resY);
        super.setVideoFrameRate(quality.frameRate);
        super.setVideoEncodingBitRate(quality.bitRate);

I saw these pages
Error opening android camera for streaming video
Android MediaRecorder - "start failed: -19"
But non of them worked for me...
Running on archos 80 g9, android 3.2 Any one got any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Fixed by removing

super.setVideoFrameRate(quality.frameRate);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...