User guide

As your app runs, a user might plug in or unplug a headset, or use a docking station with audio connections.
iOS Human Interface Guidelines describes how iOS apps should respond to such events. To implement the
recommendations, write audio session code to handle audio hardware route changes. Certain types of apps,
like games, don’t always have to respond to route changes. However other types of apps, such as media players,
must respond to all route changes.
Varieties of Audio Hardware Route Change
An audio hardware route is a wired electronic pathway for audio signals. When a user of an iOS device plugs
in or unplugs a headset, the system automatically changes the audio hardware route. Your app can listen for
such changes by way of AVAudioSessionRouteChangeNotification.
Figure 5-1 depicts the sequence of events for various route changes during recording and playback. The four
possible outcomes, shown across the bottom of the figure, result from actions taken by a property listener
callback function that you write.
Figure 5-1 Handling audio hardware route changes
2014-09-17 | Copyright © 2014 Apple Inc. All Rights Reserved.
37
Responding to Route Changes