When Android uses mediaRecorder for recording, onPreviewFrame does not call back

when I use Android camera recording while taking camera frame data for algorithm processing, I use mediaRecorder for recording and algorithm processing in onPreviewFrame.
the video recording is normal when using mediaRecorder alone. The callback is normal when using onPreviewFrame alone.
but when both are used at the same time, the callback of onPreviewFrame will not be executed.
then I set the callback using setPreviewCallback in both surfaceChanged and surfaceCreated, and there is a problem that the callback can be executed but not recorded.

I wonder if any of the students have encountered the same problem? Is there any way to solve it?

Mar.23,2021

api1 does not support calling onPreviewFrame while recording. The preview function during recording is done by mMediaRecorder.setPreviewDisplay (mPreview.getHolder (). GetSurface ());
), that is, the preview during recording is done by MediaRecorder.
to achieve video recording with callback at the same time, you can only use the implementation of camera api2.
api2 to be easy. Try Baidu yourself.


have brothers solved it?

Menu