User guide
●
Scenario 2. You write a first-person shooter game that uses OpenAL-based sound effects. You also provide
a background soundtrack but include an option for the user to turn it off and play a song from the user’s
music library instead. After starting up a motivating song, the user fires a photon torpedo at an enemy
ship, and the music stops.
To ensure that music is not interrupted, configure your audio session to allow mixing. Use the
AVAudioSessionCategoryAmbient category, or modify the AVAudioSessionCategoryPlayback
category to support mixing.
●
Scenario 3. You write a streaming radio app that uses Audio Queue Services for playback. While a user is
listening, a phone call arrives and stops your sound, as expected. The user chooses to ignore the call and
dismisses the alert. The user taps Play again to resume the music stream, but nothing happens. To resume
playback, the user must quit your app and restart it.
To handle the interruption of an audio queue gracefully, set the appropriate category and register for
AVAudioSessionInterruptionNotification and have your app respond accordingly.
How the System Resolves Competing Audio Demands
As your iOS app launches, built-in apps (Messages, Music, Safari, the phone) may be running in the background.
Each of these may produce audio: a text message arrives, a podcast you started 10 minutes ago continues
playing, and so on.
Defining an Audio Session
How the System Resolves Competing Audio Demands
2014-09-17 | Copyright © 2014 Apple Inc. All Rights Reserved.
12