1

I am using the sample code from Switch cameras with avcapturesession to swap from the iPhone's front camera to its back one during a recording session. Only the video AVCaptureDeviceInput is changed; neither the audio input device nor the AVCaptureSession itself is changed. Even so, there's a clear break in the audio during the camera swap. Why is this?

And is there any workaround? For instance, would using an AVAudioRecorder instead to record the audio separately allow for continuous audio recording during a camera flip? I could then stitch it to the video later, even though that would be a pain.

Community
  • 1
  • 1
Aaron
  • 619
  • 6
  • 15

2 Answers2

0

When switching the video camera, the audio input also changes. When recording with the front camera, the front mic is used. Some audio packets are lost in this process.

Mihai
  • 768
  • 2
  • 6
  • 18
0

I encountered the same problem, and using AVAudioRecorder to record the audio separately and AVMutableComposition to combine the audio and video tracks after recording worked perfectly.