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
5 Answers
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.

- 4,491
- 9
- 32
- 41

- 105
- 1
- 10
-
A link to a solution is welcome, but please ensure your answer is useful without it: [add context around the link](//meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. [Answers that are little more than a link may be deleted.](//stackoverflow.com/help/deleted-answers) – Filnor Mar 06 '18 at 13:57
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];

- 829
- 8
- 20
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.
-
1here is the example of the app which uses multiple camera uses https://itunes.apple.com/app/id982356043 – Nimit Parekh Jul 23 '15 at 12:12
-
1@ Nimit Parekh : I have just checked the application and it allows at a time one camera. – Paddy Jul 23 '15 at 12:20
-
-
There "DoubleCam" https://itunes.apple.com/us/app/dblcam/id605269890?mt=8 specifically made to record from both cameras – Dima Tisnek Jul 30 '17 at 14:46
Once upon a time I was experimenting with two different connections, one to the front and one to the back. One of them would always freeze up on me.
I used this to help get me started, https://github.com/alex-chan/AVCamSwift Maybe you can figure something out but I am not sure that it's possible.

- 6,696
- 4
- 32
- 55