我的媒体录像机有问题。它不能开始,来到活动线程。我找不到问题。所有权限设置。 谢谢你帮帮我:)
private void startCaptureVideo()
{
camera = getCameraInstance();
//cameraPreview = new cameraPreview(this,camera);
try {
surfaceHolder = selfImage.getHolder();
camera.setPreviewDisplay(surfaceHolder);
camera.startPreview();
} catch (IOException e) {
e.printStackTrace();
}
camera.lock();
if(checkCameraHardware(this)) {
mediaRecorder.setCamera(camera);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
File file = new File(this.getFilesDir(), "masterVideo"+System.currentTimeMillis());
mediaRecorder.setOutputFile(file.getPath());
mediaRecorder.setPreviewDisplay(surfaceHolder.getSurface());
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
mediaRecorder.setVideoSize(selfImage.getWidth(), selfImage.getHeight());
try {
mediaRecorder.prepare();
// mediaRecorder.start();
} catch (IOException e) {
e.printStackTrace();
}
mediaRecorder.start();
}
else
Toast.makeText(this,":( :( :(",Toast.LENGTH_SHORT);
}