AVAudioPlayer, using AmbientSound session, is not playing when app is in background

半城伤御伤魂 提交于 2019-11-29 16:15:30

Had to submit a tech support request for this in the end.

According to Apple background playback is not supported by the AmbientSound category - you have to use MediaPlayback.

They claim this is in the documentation - I've looked again and I could not find it.

Ok so getting background sounds to mix into MediaPlayback is easy enough using kAudioSessionProperty_OverrideCategoryMixWithOthers - but I am now going to have to jump through some other hoops to replicate the other AmbientSound functionality (obeying the mute switch and not playing when locked). I really don't understand why AmbientSound is not supported playing in background - but there we go.

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