Switch camera while recording video?

Hi,


I have an app that includes a very simple one-button interface for recording a video. Our customer wants to be able to switch between the front and rear cameras while the video is being recorded, and without any interruption in the video stream. I notice that even the iOS built-in camera app doesn't do this, but I've heard that some third-party apps do.


Is this possible in a practical way? If so, how would I go about it?


Thanks,

Frank

To truly support this, you'd need to run both cameras simultaneously, which is not currently supported. The best you can do is use an AVCaptureSession with a VideoDataOutput and record it to AVAssetWriter. When you want to change cameras,


[session beginConfiguration];

[session removeInput:backCameraInput];

[session addInput:frontCameraInput];

// ENSURE THAT BOTH CAMERAS ARE CONFIGURED TO GIVE YOU THE SAME RESOLUTION!!!

[session commitConfiguration];


You'll notice a brief glitch in the recording where cameras were switched (audio will glitch too), but you'll at least be able to continue recording to the same movie file (AVAssetWriter stays open across the swap).

Yes ofcourse it's possible because app Moviero can do this. https://apps.apple.com/us/app/moviepro-video-recorder/id547101144

The main issue is AVCaptureAudioDataOutput hangs while you switch cameras which makes it useless. I have filed a bug many years back and it still remains open.

Switch camera while recording video?
 
 
Q