AVAudioSessionInterruptionNotification not triggered when capture device active

为君一笑 提交于 2019-12-07 07:07:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!