In Android, is it possible to change the camera (front to back) and continue recording?

What is my question :). If I start recording using Front Camera with MediaRecorder and then switch to the rear camera, can I continue recording using the same video file? Also, is it possible to record both cameras at the same time?

+10
android camera mediarecorder
Mar 19 '14 at 14:01
source share
1 answer

You can do it on Nexus9 using camera2 api. (Nexus5 cannot open 2 cameras at the same time)

  • Create 2 Gl (Shared) contexts and 2 texture buffers.
  • Create a TextureView to preview.
  • Create a MediaRecoder for recording.
  • Open the front and rear cameras.
  • Re-query that the output target is a texture buffer.
  • Map a scene with 2 textures onto a TextureView surface for each frame.
  • Display a scene with 2 textures on the MediaRecoder surface for each frame.

You can switch to each camera by changing the rendering object. You can also display both images in the same video using alpha blending, transforming, scaling, etc. 30 frames per second

+3
Apr 20 '15 at 5:23
source share



All Articles