如何在 iPhone 上的锁定模式下播放声音
每个人都知道在用户按下锁定按钮(无声)后保持应用程序运行的标准程序。 如果我用 AVAudioPlayer 启动声音(在 iPhone 锁定之前),声音会一直播放到结束(锁定后)。该应用程序仍在运行。如果我在 iPhone 锁定时尝试启动另一个声音,它永远不会播放。所有其他功能都可以正常工作,但声音却不行。
iPhone 锁定时如何播放声音?
Everybody knows the standard procedure to keep your app alive, after the user pressed the lock button (silent sound).
If I start a sound with AVAudioPlayer (before the iphone is locked), the sound plays till it's end (after locking). The app is still running. If I try to start another sound while the iPhone is locked, it will never get played. All the other things work as well but the sound doesn't.
How can I play a sound while the iphone is locked?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果问题是您的应用程序在屏幕锁定后进入睡眠状态,那么这个问题已经得到解答 此处和这里
If the problem is that your app is doing to sleep after the screen locks, then this question is already answered here and here on SO
我不确定你的问题出在哪里,但是你是否设置了音频类别以允许混合?
I'm not sure where your problem is, but have you set up the audio category to allow mixing?
现在一切正常!我错过了一条日志语句。看来我淹没了音频缓冲区!
感谢所有试图帮助我解决这个问题的人。
Now all works fine! I missed a log statement. It seems I flooded the audio buffer!
Thanks to all who tried to help me fixing this.