Protocol

AVAudioSessionDelegate

The use of this protocol is deprecated in iOS 6 and later. Instead, you should use the notifications declared in AVAudioSession.

Overview

The delegate of an AVAudioSession object must adopt the AVAudioSessionDelegate protocol. The methods in this protocol are optional. They allow a delegate to respond to the following sorts of changes in state:

  • Changes to the availability of audio input

  • Audio session interruption, or end of audio session interruption

An AVAudioSession delegate can respond to interruptions at the audio session level. You can use this interface along with any iOS audio technology. For example, your AVAudioSession delegate can handle interruptions for OpenAL and audio unit playback.

When using the AV Foundation framework for recording or playback, you can also respond to interruptions at the individual recorder or player level. To do this, create audio recorder or audio player delegates using the protocols described in AVAudioRecorderDelegate and AVAudioPlayerDelegate.

Topics

Delegate Methods

func beginInterruption()

Called after your audio session is interrupted.

func endInterruption()

Called after your audio session interruption ends.

func endInterruption(withFlags: Int)

Called after your audio session interruption ends, with flags indicating the state of the audio session.

func inputIsAvailableChanged(Bool)

Called after the availability of audio input changes on a device.

Relationships

Inherits From

See Also

Supporting Types

class AVAudioSessionChannelDescription

A channel description provides descriptive information about a hardware channel on the current device.

class AVAudioSessionDataSourceDescription

A data source description defines a data source for an audio input or output, providing information such as the source’s name, location and orientation.

class AVAudioSessionPortDescription

A port description object describes a single input or output port associated with an audio route. You can use the information in this class to obtain information about the capabilities of the port and the hardware channels it supports.

class AVAudioSessionRouteDescription

A route description manages the input and output ports associated with the current audio route for a session.