I would like to record videos with audio using AVCaptureSession
. For this I need the AudioSessionCategory AVAudioSessionCategoryPlayAndRecord
, since my
[self.captureSession startRunning];
[[AVAudioSession sharedInstance] setActive:NO withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
[[AVAudioSession sharedInstance] setActive:YES withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];
When capureSession startRunning, deactive current audioSession and resume other interrupted music app on the background use this option AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation
.
Reset the category AVAudioSessionCategoryPlayAndRecord
with current audioSession,and avtive again.
I hope it works for you.