An audio session communicates to the system how you intend to use audio in your app.
- iOS 3.0+
- macOS 10.13+Beta
- tvOS 9.0+
- watchOS 2.0+
An audio session acts as an intermediary between your app and the operating system—and in turn, the underlying audio hardware. You use it to communicate to the operating system the nature of your app’s audio without detailing the specific behavior or required interactions with the audio hardware. This delegates the management of those details to the audio session, which ensures that the operating system can best manage the user’s audio experience.
Use this class to:
Configure the audio session category and mode to communicate to the system how you intend to use audio in your app
Activate your app’s audio session to put your category and mode configuration into action
Request user permission to record audio
Subscribe and respond to important audio session notifications, such as audio interruptions and route changes
Perform advanced audio device configuration such as setting sample rate, I/O buffer duration, and number of channels