MediaRecorder.start()之后摄像机的onPreviewCallback

时间:2018-09-12 14:49:23

标签: android android-camera mediarecorder android-mediarecorder

我使用下一个代码初始化我的相机

def compute_xp(i, b):
    return 44993 + i if b else 44993

mSurfaceTexture = new SurfaceTexture(MAGIC_TEXTURE_ID); sCamera.setPreviewTexture(mSurfaceTexture); sCamera.startPreview(); sCamera.addCallbackBuffer(mBuffer); sCamera.setPreviewCallbackWithBuffer(this); 工作正常(被调用)

onPreviewFrame

然后,当我开始@Override public void onPreviewFrame(byte[] bytes, Camera camera) { Log.i(TAG, "onPreviewFrame"); if (sCamera != null) { sCamera.addCallbackBuffer(mBuffer); } } 进行视频录制时

MediaRecorder

sCamera.unlock(); mMediaRecorder.setCamera(sCamera); // ... setup MediaRecorder mMediaRecorder.start(); try { sCamera.reconnect(); } catch (IOException e) { e.printStackTrace(); } sCamera.addCallbackBuffer(mBuffer); sCamera.setPreviewCallbackWithBuffer(this); 停止工作(不再调用)

0 个答案:

没有答案