开发者

What happens if I don't handle audio interruptions?

Is it possible to still play sound / music even if audio has been interrupted, or more precisely: even if MyInterruptionListener got called from the OS with the interruption state kAudioSessionBeginInterruption ?

Yeah I know that's开发者_JAVA技巧 not good idea to do. But want to know anyways.


By the time you get an interrupt message, the audio resources you've been using have been shut down.

For AVAudioPlayer, playback will be stopped until you start it again.

For OpenAL, your context will be invalid. All OpenAL commands will fail with an error until you clear the current context and set it to current again.

For Audio Units, your graph will be in an invalid state. No sound will be played until you set the graph inactive and then active.

I don't know what would happen if you tried to start your audio resources again upon getting an interrupt start message, but at the very least you'd get rejected in the app store if the reviewers ever discovered this behavior.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜