AVAudioSession Interruptions

狂风中的少年 提交于 2019-11-30 12:30:16

Do you have an AVCaptureSession instance in your application?
If that is the case, I would suggest the same answer that I received for my linked question:
Try to set NO to the usesApplicationAudioSession property of your AVCaptureSession instance.
It is a property available since iOS 7. In the previous iOS versions, each AVCaptureSession made use of a private AVAudioSession. Since iOS 7, the Capture Sessions make use of the shared application's AVAudioSession.
The usesApplicationAudioSession property is enabled by default, so if you want to keep the old behavior you must disable it, by setting NO.

I hope this will work for you as well.

You didn’t pass the AVAudioSession instance in your addObserver call as the last parameter.

Try this:

AVAudioSession *session = [AVAudioSession sharedInstance];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(AudioInterruption:)
                                             name:AVAudioSessionInterruptionNotification
                                           object:session];
adrian.ana

For me, activating audio session and adding observer when user actually push play button has resolved the issue; notification was fired. I think apple doc say something about that here.

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