문제

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