问题
I'm having a problem with "AVAudioSessionInterruptionNotification" on iOS 7.0.4.
I sign up for it on the NSNotificationCenter, and I activate AVAudioSession.
Everything works fine, but if a camera is activated, that particular notification is not triggered anymore, neither for the beginning of an interruption, nor for the end of it.
I test audio interruptions by receiving cell calls on an iPhone4, and also by making an alarm ring while the app is running.
I also tried using the notification with the "AVCam" sample app, and I have the same problem.
What is the relationship between audio interruptions and camera activation? Why would audio interruptions stop being triggered if a camera is turned on? Could this be an iOS bug?
Edit jan 10, 2014: I updated to iOS 7.1 beta 3, and the problem is still present.
Thank you.
回答1:
set the camera/capture device object property usesApplicationAudioSession to NO and all will be fine
You can use AVCaptureSession:
captureSession = [[AVCaptureSession alloc] init];
...
captureSession.usesApplicationAudioSession = NO;
来源:https://stackoverflow.com/questions/20334467/avaudiosessioninterruptionnotification-not-triggered-when-capture-device-active