Hy everyone. I am trying to add a small logo in the corner to the video i've recorded . I've tried to add the imageView directly to the recording surface but it is not the solution.
I guess i'll have to create another surface and merge them together but i couldn't find any tutorial or code sample for such a thing.
I've found the option to add a foreground drawable but it doesn't show the logo on the preview surface. This is the code:
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();
}
}
please help. Thanks