Audio Session Categories

Category identifiers for audio sessions, used to set the session's category property.

Overview

An audio session category defines a set of audio behaviors. The precise behaviors associated with each category are not under your app’s control, but rather are set by the operating system. Apple may refine category behavior in future versions of the OS. Your best strategy when selecting a category that most accurately describes your intentions for the audio behavior you want.

You can refine the configuration provided by the playback, record, and playAndRecord categories by using an audio session mode, as described in Audio Session Modes.

Supporting AirPlay

The audio session playback-only categories (AVAudioSessionCategoryAmbient, AVAudioSessionCategorySoloAmbient and AVAudioSessionCategoryPlayback) support both the mirrored and non-mirrored variants of AirPlay.

The audio session category AVAudioSessionCategoryPlayAndRecord supports only the mirrored variant of AirPlay while the AVAudioSessionCategoryRecord and AVAudioSessionCategoryMultiRoute categories do not allow routing to AirPlay.

Topics

Constants

static let ambient: AVAudioSession.Category

The category for an app in which sound playback is nonprimary—that is, your app can be used successfully with the sound turned off.

static let soloAmbient: AVAudioSession.Category

The default audio session category.

static let playback: AVAudioSession.Category

The category for playing recorded music or other sounds that are central to the successful use of your app.

static let record: AVAudioSession.Category

The category for recording audio; this category silences playback audio.

static let playAndRecord: AVAudioSession.Category

The category for recording (input) and playback (output) of audio, such as for a VoIP (Voice over Internet Protocol) app.

static let multiRoute: AVAudioSession.Category

The category for routing distinct streams of audio data to different output devices at the same time.

static let audioProcessing: AVAudioSession.Category

The category for using an audio hardware codec or signal processor while not playing or recording audio.

Deprecated