CameraX and MediaRecorder for recording video

Viewed 413

I tried to use CameraX PreviewView here

            <androidx.camera.view.PreviewView
                android:id="@+id/camPreviewView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

I'm able to use MediaProjection for recording video for whole screen.

But now, I need to record only the camera view. I tried to use setPreviewDisplay from MediaRecorder, but since I'm using PreviewView I had no idea how to get the surface.

I also tried to used the setCamera from MediaRecorder, but it is deprecated. It suggest to use getSurface instead.

Is there any example to use MediaRecorder with CameraX PreviewView out there ?

There is VideoCapture for CameraX but for some reason, I can't use it. I need to use MediaRecorder and CameraX PreviewView for recording file.

Any suggestion ?

0 Answers
Related