How to record video with both front and back camera at a time in iOS with swift. That is while recording video from iPhone with front camera I want to open back camera and record video. That means finally in one video file I just want to cover both sides
You can see the feed from all the cameras present on your iPhone. Just select any two cameras, which you want to record with, in this case the front and back camera, and just hit the record button, it's that simple. Another benefit of the app is that you can also record footage from the different cameras on the back.
With iOS 13, it is now possible to simultaneously capture video natively on both front and back cameras on an iPhone with the A12 chip or later, or an iPad with the A12X chip or later.
Check out the new AVCaptureMultiCamSession class.
AVCaptureMultiCamSession
A capture session that supports simultaneous capture from multiple inputs of the same media type.
Your question is a little unclear though. If instead of simultaneously recording both cameras, you're looking to switch between cameras during the recording, you can utilise this functionality and "merge" the shots at the timestamp where the user switches between the front and back cameras. On older devices, the only way to do that is to stop and restart the recording in a different camera.
According to AVFoundation Programming Guide provided by Apple:
Media capture does not support simultaneous capture of both the front-facing and back-facing cameras on iOS devices.
I don't think it's could record both camera at one time in IOS. You could check AVCaptureDeviceInput class.
This is how I catch the video from session queue
AVCaptureDevice *videoDevice = [iSKITACamViewController deviceWithMediaType:AVMediaTypeVideo preferringPosition:preferredPosition];
AVCaptureDeviceInput *videoDeviceInput = [AVCaptureDeviceInput
deviceInputWithDevice:videoDevice error:nil];
[[self session] beginConfiguration];
I think you can not access both cameras at a time, means if you are recording with the front camera you don't access the back camera and vice versa. You can check this link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With