質問

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