Alexander
Alexander

Reputation: 48232

Any way to get preview frames while recording video?

I want to stream video to a server and record it on the device at the same time.

If I'm not recording the video I can use Camera.onPreviewCallback where I get the preview data as a byte array and I send the data to the server.

When I start recording though (I'm using MediaRecorder) then onPreviewCallback is called no more.

How can I still obtain the frames from the camera?

Upvotes: 0

Views: 948

Answers (1)

Eddy Talvala
Eddy Talvala

Reputation: 18097

Getting preview callbacks at the same time as recording video is not currently supported by the camera API.

On the latest Android versions, you could use a SurfaceTexture for your preview output, and read the textures back from the GPU to send to your server, instead of using the preview callbacks.

Upvotes: 1

Related Questions