User guide

Working with Movie Players
By default, a movie player shares your apps audio session. In effect, a movie player transcends the notion of
mixing with your apps audio; the movie player’s audio behaves as though it belongs to your app. No matter
which playback category you choose, and no matter how you configure that category, your audio and the
movie players audio never interrupt each other.
Sharing your audio session also gives you control over how a movie interacts with audio from other apps, such
as the Music app. For example, if you set your category to AVAudioSessionCategoryAmbient and share
your session, Music audio is not interrupted when a movie starts in your app. Sharing your audio session also
lets you specify whether or not movie audio obeys the Ring/Silent switch.
To configure audio behavior for a movie, determine the behavior you want and then perform appropriate
audio session configuration, as described in Table 6-1. For details on setting up your audio session, see Defining
an Audio Session (page 10).
Table 6-1 Configuring audio sessions when using a movie player
Audio session configurationDesired behavior
If your app does not play audio, do not configure an audio session.
If your app does play audio, configure an audio session and set
its mix-ability according to whether or not you want to mix with
the Music app and other audio.
In either case, tell the movie player to use its own audio session:
myMoviePlayer.useappAudioSession = NO
Playing a movie silences all
other audio
Configure an audio session using a non-mixable category.
Take advantage of the movie players default useApplication-
AudioSession value of YES.
Movie and app audio mix, but
other audio, including the
Music app, is silenced
Configure an audio session using a mixable category configuration.
Take advantage of the movie players default useApplication-
AudioSession value of YES.
All audio mixes
Manage your apps audio session as usual in terms of route changes and interruptions, as described in
Responding to Route Changes (page 37) and Responding to Interruptions (page 26). Enable ducking, if desired,
as described in Fine-Tuning a Category (page 24).
Fine-Tuning an Audio Session for Players
Working with Movie Players
2014-09-17 | Copyright © 2014 Apple Inc. All Rights Reserved.
41