Вопрос

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

Это было полезно?

Решение

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

Другие советы

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top