使用媒体记录器录制视频的IllegalStateException

时间:2015-12-04 15:08:23

标签: android video-capture mediarecorder

 captureButton.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {

                mMediaRecorder = new MediaRecorder();
                mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
                mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
                mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);

以下部分不起作用:(1) - 它要求创建新预览的上下文

              //  mPreview = new Preview(,mMediaRecorder);
                setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
                mMediaRecorder.stop();
                //setContentView(mPreview);

以下部分不起作用:(2)

                mMediaRecorder.start();
                return isRecording = true;
            }

        });

0 个答案:

没有答案