大家好。我正在尝试在我录制的视频的角落添加一个小徽标。我尝试将 imageView 直接添加到记录表面,但这不是解决方案。
我想我必须创建另一个表面并将它们合并在一起,但我找不到任何教程或代码示例。
我找到了添加前景可绘制的选项,但它没有在预览表面上显示徽标。这是代码:
private void startRecording(){
try {
setupMediaRecorder();
mTextureView.setForeground(getDrawable(R.drawable.toolbarlogo));
SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();
surfaceTexture.setDefaultBufferSize(mPreviewSize.getWidth(),mPreviewSize.getHeight());
Surface previewSurfice = new Surface(surfaceTexture);
Surface recordSurface = mMediaRecorder.getSurface();
mPreviewCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);
mPreviewCaptureRequestBuilder.addTarget(previewSurfice);
mPreviewCaptureRequestBuilder.addTarget(recordSurface);
mCameraDevice.createCaptureSession(Arrays.asList(previewSurfice, recordSurface), new CameraCaptureSession.StateCallback() {
@Override
public void onConfigured(@NonNull CameraCaptureSession session) {
try {
session.setRepeatingRequest(
mPreviewCaptureRequestBuilder.build(),null,null
);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
@Override
public void onConfigureFailed(@NonNull CameraCaptureSession session) {
}
},null);
} catch (Exception e) {
e.printStackTrace();
}
}
请帮忙。谢谢