Headphones unplugged during playback cause bug on iPhone app

此生再无相见时 提交于 2019-12-04 15:23:39

After further investigation I realize now that I essentially asked two questions here. I've solved one so far.

Sometimes when the playback is interrupted it is 'paused' rather than 'stopped'. I just eliminated any elements of the code that did this 'pausing' and replaced it with calls to 'stop' the audio and wind back it's queue.

As for the audio coming out of the speakers instead of the headphones, I'm still looking into that one.

Have you tried implementing the AVAudioSessionDelegate protocol that should fire the interrupt delegate methods when things like the headphones are unplugged. Documentation here.

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