Question

I am able to record a video on Android, but can I do so without previewing the video on my screen?

Here is the working code for the surfaceView:

surfaceView = (SurfaceView) findViewById(R.id.surface_camera);
surfaceHolder = surfaceView.getHolder();
surfaceHolder.addCallback(this);
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

Can I manually input the size of surfaceHolder instead of doing

surfaceHolder = surfaceView.getHolder();

Thank you

Was it helpful?

Solution

Camera on android platform can't stream video without valid preview surface. You can resize the size of preview surface to 1x1 pixels.

OTHER TIPS

If the query getSupportedVideoSizes() returns null for camera parameters, then it means the camera has only preview stream and no separate recording stream. If thats not the case then recording can happen without the preview being started.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top