endInterruption 每次都不会被调用
我正在使用 openCL 播放声音,我注意到在呼叫进入并按“拒绝”后声音停止运行。 我能够追踪到 endInterruption 没有被调用。
问题是,在我重复复制的 5 次中,这种情况只发生一次。 这意味着我的代码没问题,因为在大多数情况下它确实调用了 endInterruption,但每隔一段时间 iOS 就会决定不调用 endInterruption,我不知道为什么。
I am using openCL to play sounds and I have noted that the sounds stop functioning after a call enters and I press Decline.
I was able to trace it to the endInterruption not being called.
The problem is that this happens only about once out of 5 times I repeat the replication.
This means that my code is ok, because in the majority of times it does call endInterruption, but still every other time iOS decides not to call endInterruption and I have no idea why.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查您是否从后台线程而不是主线程调用“播放”函数。如果有时您从后台线程发起 play/playAtTime 调用,您将不会收到 endInterruption 回调。
但有趣的是,即使播放调用是从后台线程发起的,系统也会调用 beginInterruption。
希望这有帮助。
Check if you are calling the "play" functions from a background thread instead of the main thread. If sometimes you initiate the play/playAtTime call from a background thread, you will not receive the endInterruption callback.
Interestingly though, the system does call beginInterruption even when the play call was initiated from a background thread.
Hope this helps.