Hi mrousavy,
I am not sure if this is a preferred method, however, I have been able to make the desired functionality work using the following.
When you initialise the capture session, ensure captureSession.automaticallyConfiguresApplicationAudioSession = true (this is the default).
In your AppDelegate file
set AVAudioSession.Category to ambient
AVAudioSession.sharedInstance().setActive(true)
On record tap:
AVAudioSession.sharedInstance().setActive(false)
Set your AVAudioSession.Category to playAndRecord
AVAudioSession.sharedInstance().setActive(true)
set captureSession.automaticallyConfiguresApplicationAudioSession = false
add your audio input to the capture session
Begin the video recording.
On stop record tap:
Stop video recording.
AVAudioSession.sharedInstance().setActive(false)
remove your audio input from the capture session
Set your AVAudioSession.Category to ambient
AVAudioSession.sharedInstance().setActive(true)
Again, I'm not sure if this is the best way of doing it, but this is what has worked for me. Hopefully this will help you.
Ben