我看了文档和几个Android Camera2 API示例。 它们都支持在预览相机会话的过程中添加预览。例如:
cameraDevice.createCaptureSession(Collections.singletonList(previewSurface),
new CameraCaptureSession.StateCallback() {
@Override
public void onConfigured(CameraCaptureSession cameraCaptureSession) {
if (cameraDevice == null) {
return;
}
try {
captureRequest = captureRequestBuilder.build();
CameraActivity.this.cameraCaptureSession = cameraCaptureSession;
CameraActivity.this.cameraCaptureSession.setRepeatingRequest(captureRequest,
null, backgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
@Override
public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {
}
}, backgroundHandler);
Camera2 Android API 21级中是否可以在不重新启动会话的情况下向相机会话添加表面/纹理视图?是否可以使用Camera2启动/停止预览?