后置摄像头工作正常,但是,当我们从后置摄像头切换到前置摄像头时,它会崩溃(在使用 MediaRecorder 进行视频录制的情况下)......它显示错误,我在日志中显示!
这是我的代码:
private void start_work()
{
if(recording)
{
Log.v("LOGTAG", "Recording Stopped");
}
else
{
recording = true;
progress_relative_lay.setVisibility(View.VISIBLE);
button_capture.setVisibility(View.GONE);
//show_icon();
recorder.start();
Log.v("LOGTAG", "Recording Started");
}
}
并为初始化我使用
recorder = new MediaRecorder();
recorder.setOrientationHint(result) ;
recorder.setPreviewDisplay(holder.getSurface());
if(usecamera)
{
camera.unlock();
recorder.setCamera(camera);
}
recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
recorder.setProfile(camcorderProfile);