SKAction playSoundFileNamed doesn't work after receiving two consecutive phone calls

蹲街弑〆低调 提交于 2019-11-30 18:06:47

The SKAction playSoundFileNamed is buggy in regards to the app transitioning between background and foreground. That's the reason why you are having this issue. I am not sure if this problem has been corrected in iOS 9.

As for a workaround, you stated you're not interest but I will include one for completion's sake. Use AVAudioPlayer instead of SKAction. AVAP has the ability to stop and start (using its delegates) based on your app's state.

This could be an issue with mixed audio. I've found that enabling mixed audio no longer stops SpriteKit's audio engine during an interruption, ad video playing, or app backgrounding.

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