相关疑难解决方法(0)

Android相机服务器死机和相机错误 - 100

我在测试我的Android应用程序时StackOverflow遇到了Camera error 100,我发现了一些主题,但它们并没有那么有用.我正在寻找解决错误的相关解决方案.

我写的代码:

mrec = new MediaRecorder();  // Works well

mCamera = Camera.open();
mCamera.unlock();

mrec.setCamera(mCamera);
mrec.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mrec.setAudioSource(MediaRecorder.AudioSource.MIC); 

mrec.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));

mrec.setOutputFile("/sdcard/zzzz.3gp");

mrec.prepare();
mrec.start(); 
Run Code Online (Sandbox Code Playgroud)

记录相机的代码:

protected void startRecordingVideo() throws IOException 
{
camera = Camera.open();
camera.unlock();
SimpleDateFormat timeStampFormat = new SimpleDateFormat(
        "yyyy-MM-dd-HH.mm.ss");
String fileName = "video_" + timeStampFormat.format(new Date())
        + ".3gp";
String fileURL = "/sdcard/"+fileName;
surfaceView = (SurfaceView) findViewById(R.id.surface_camera);
surfaceHolder = surfaceView.getHolder();
surfaceHolder.addCallback(this);
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mrec = new MediaRecorder();

mrec.setCamera(camera);

mrec.setPreviewDisplay(surfaceHolder.getSurface());
mrec.setVideoSource(MediaRecorder.VideoSource.CAMERA);
    mrec.setAudioSource(MediaRecorder.AudioSource.MIC); 
    mrec.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_LOW));
    mrec.setPreviewDisplay(surfaceHolder.getSurface());
    mrec.setOutputFile("/sdcard/"+fileName); 

    mrec.prepare();
    mrec.start();
}

protected void stopRecordingVideo() …
Run Code Online (Sandbox Code Playgroud)

android android-camera

15
推荐指数
1
解决办法
3万
查看次数

标签 统计

android ×1

android-camera ×1