Audio Guidelines By App Type
The latest driving game does not have the same audio requirements as a real-time video chat app. The following sections provide design guidelines for different types of audio apps.
Audio Guidelines for Game Apps
Most games require user interaction for anything to happen in the game. Use the AVAudioSessionCategoryAmbient
or AVAudioSessionCategorySoloAmbient
categories when designing games. When users bring up another app or lock the screen, they do not expect the app to continue playing. Often they want the audio from another app to continue playing while the game app plays.
Here are some recommended guidelines:
Activate your audio session in the app delegate’s
applicationDidBecomeActive:
method.Play app sound effects while allowing another app’s audio to play.
Play app soundtrack audio when other audio is not playing, otherwise allow the previous audio to play.
Always attempt to reactivate and resume playback of sound effects after an end interruption event.
Query the audio session’s
secondaryAudioShouldBeSilencedHint
property to determine if you should resume playback of your game’s soundtrack.Ignore all route changes unless the app specifically needs to pay attention to them.
Set the audio category before displaying a video splash on app launch.
Audio Guidelines for User-Controlled Playback and Recording Apps
Recording apps and playback apps such as Pandora and Netflix have similar guidelines. These types of apps use the AVAudioSessionCategoryRecord
, AVAudioSessionCategoryPlayAndRecord
, or AVAudioSessionCategoryPlayback
categories and typically interrupt other system audio when their audio sessions are activated. The UI will include a play/pause button or a record/pause button.
Here are some recommended guidelines:
When the app enters the foreground, wait for the user to press the Play or Record button before activating the audio session.
While the app is in the foreground, keep the audio session active unless it’s interrupted.
If the app is not actively playing or recording audio when it transitions to the background, deactivate its audio session. This prevents its audio session from being interrupted by another nonmixable app or by the system in response to the app being suspended.
Update the UI to indicate that playback or recording has paused when it’s interrupted. Do not deactivate the audio session.
Observe notifications of type
AVAudioSessionInterruptionNotification
to be notified of audio session interruptions. When an interruption ends, don’t start playing or recording audio again unless the app was doing so prior to the interruption.Pause playback or recording if a route change is caused by an unplug event, but keep the audio session active.
Assume the app’s audio session is inactive when it transitions from a suspended to foreground state. Reactivate the audio session when the user presses the Play or Record button.
Ensure that the audio
UIBackgroundModes
flag is set.Register for remote control events (see
MPRemoteCommandCenter
) and provide the appropriate Now Playing information for your media (seeMPNowPlayingInfoCenter
).Use an
MPVolumeView
object to present the system volume slider and route picker.Use a background task instead of streaming silence to keep the app from being suspended.
Ask the user for permission to record input using the
requestRecordPermission:
method. Don’t rely on the operating system to prompt the user.For recording apps, use the
AVAudioSessionCategoryPlayAndRecord
category instead of theAVAudioSessionCategoryRecord
category. The recording-only category silences virtually all system output and is usually too restrictive for most apps.
Audio Guidelines for VoIP and Chat Apps
VoIP and chat apps require that both input and output routes are available. These types of apps use the AVAudioSessionCategoryPlayAndRecord
category and do not mix with other apps.
Here are some recommended guidelines:
Only activate an audio session when the user answers or initiates a call.
Update the UI to reflect that the call’s audio has been interrupted after an interruption notification.
Do not activate an audio session after an interruption until the user answers or initiates a call.
Deactivate the audio session after a call ends, using the
AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation
constant.Ignore all route changes unless the app specifically needs to pay attention to them. For instance, route changes may result in changes to the session’s sample rate, buffer duration, or latency. If these values are relevant to your app, query them after a route change to get their latest state.
For VoIP apps, use Apple's Voice Processing I/O audio unit.
Ensure that the audio
UIBackgroundModes
flag is set.Use an
MPVolumeView
object for the volume slide and route picker.Ask the user for permission to record input, using the
requestRecordPermission:
method. Don’t rely on the operating system to prompt the user.
Starting in iOS 10, to build VoIP apps with the same features and capabilities found in built-in telephony apps (Phone and FaceTime apps), use the CallKit framework. For more information, see CallKit Framework Reference.
Audio Guidelines for Metering Apps
Metering apps need the minimal amount of system-supplied signal processing applied to the input and output routes. Set the AVAudioSessionCategoryPlayAndRecord
category and the measurement mode to minimize signal processing. Also, apps of this type do not mix with other apps.
Here are some recommended guidelines:
Always attempt to reactivate and resume playback after an end interruption event.
Ignore all route changes unless the app specifically needs to pay attention to them.
Set the audio category before displaying a video splash on app launch.
Ask the user for permission to record input, using the
requestRecordPermission:
method. Don’t rely on the operating system to prompt the user.
Audio Guidelines for Browser-like Apps That Sometimes Play Audio
Social media or other browser-like apps often play short videos. They use the AVAudioSessionCategoryPlayback
category and do not obey the ringer switch. These apps also do not mix with other apps.
Here are some recommended guidelines:
Always wait for the user to initiate playback.
Deactivate the audio session after a video ends, using the
AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation
constant.Pause the audio session due to a route change caused by an unplug event, but keep the audio session active.
Register for remote control events while video is playing, and unregister when the video ends.
Update the UI when the app receives a begin interruption event.
Wait for the user to initiate playback after receiving an end interruption event.
Audio Guidelines for Navigation and Workout Apps
Navigation and workout apps use the AVAudioSessionCategoryPlayback
or AVAudioSessionCategoryPlayAndRecord
categories. The audio from these apps typically consists of short voice prompts. When played, these prompts interrupt spoken audio, such as a podcast or an audio book, and mix with (and duck) other audio, such as playback from the Music app.
Here are some recommended guidelines:
Activate your audio session using both the
AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers
andAVAudioSessionCategoryOptionDuckOthers
options.Do not activate the audio session until a prompt is needed.
Always deactivate the audio session after a prompt is played.
Don’t attempt to resume playback of a prompt that was interrupted.
Audio Guidelines for Cooperative Music Apps
Cooperative music apps are designed to play while other apps are playing. These types of apps use the AVAudioSessionCategoryPlayback
or AVAudioSessionCategoryPlayAndRecord
category and mix with other apps.
Here are some recommended guidelines:
Activate your audio session using the
AVAudioSessionCategoryOptionMixWithOthers
option.If the app’s UI does not provide a start/stop button, follow the guidelines for game apps.
If the app’s UI provides a start/stop button, only activate the audio session when the user presses the play button.
Do not sign up for remote control events.
Ensure that the audio
UIBackgroundModes
flag is set.If the app records user input, ask the user for permission to record input, using the
requestRecordPermission:
method. Don’t rely on the operating system to prompt the user.
Copyright © 2017 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2017-09-19