Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
即使音频被中断,是否仍然可以播放声音/音乐,或者更准确地说:即使从操作系统调用 MyInterruptionListener 并且中断状态为 kAudioSessionBeginInterruption ?
是的,我知道这样做不是个好主意。不过还是想知道。
当您收到中断消息时,您一直在使用的音频资源已被关闭。
对于 AVAudioPlayer,播放将停止,直到您再次启动它。
对于 OpenAL,您的上下文将无效。在您清除当前上下文并将其再次设置为当前上下文之前,所有 OpenAL 命令都将失败并出现错误。
对于音频单元,您的图表将处于无效状态。在您将图表设置为非活动状态然后激活之前,不会播放任何声音。
我不知道如果您在收到中断启动消息后尝试再次启动音频资源会发生什么,但如果评论者发现这种行为,至少您会在应用商店中被拒绝。