Class ISN_AVAudioSession
An intermediary object that communicates to the system how you intend to use audio in your app.
An audio session acts as an intermediary between your app and the operating system—and, in turn, the underlying audio hardware. You use an audio session 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 behavior delegates the management of those details to the audio session, which ensures that the operating system can best manage the user’s audio experience.
Inheritance
Inherited Members
Namespace: SA.iOS.AVFoundation
Assembly: cs.temp.dll.dll
Syntax
public static class ISN_AVAudioSession
Properties
Category
The current audio session category. An audio session category defines a set of audio behaviors for your app. The default category assigned to an audio session is SoloAmbient.
Declaration
public static ISN_AVAudioSessionCategory Category { get; }
Property Value
Type | Description |
---|---|
ISN_AVAudioSessionCategory |
CategoryOptions
The set of options associated with the current audio session category.
You use category options to tailor the behavior of the active audio session category. See ISN_AVAudioSessionCategoryOptions for the supported values.
Declaration
public static ISN_AVAudioSessionCategoryOptions CategoryOptions { get; }
Property Value
Type | Description |
---|---|
ISN_AVAudioSessionCategoryOptions |
OnAudioSessionRouteChange
The event is posted when the system’s audio route changes.
Declaration
public static SA_iEvent<ISN_AVAudioSessionRouteChangeReason> OnAudioSessionRouteChange { get; }
Property Value
Type | Description |
---|---|
SA_iEvent<ISN_AVAudioSessionRouteChangeReason> | The on audio session route change. |
Methods
SetActive(Boolean)
Activates or deactivates your app’s audio session.
If another active audio session has higher priority than yours (for example, a phone call), and neither audio session allows mixing, attempting to activate your audio session fails. Deactivating your session will fail if any associated audio objects (such as queues, converters, players, or recorders) are currently running.
Declaration
public static SA_Result SetActive(bool isActive)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isActive | Use |
Returns
Type | Description |
---|---|
SA_Result | Returns operation result info |
SetCategory(ISN_AVAudioSessionCategory)
Sets the current audio session category.
The audio session's category defines how the app intends to use audio. Typically, you set the category before activating the session. You can also set the category while the session is active, but this results in an immediate route change.
Declaration
public static SA_Result SetCategory(ISN_AVAudioSessionCategory category)
Parameters
Type | Name | Description |
---|---|---|
ISN_AVAudioSessionCategory | category | The audio session category to apply to the audio session. |
Returns
Type | Description |
---|---|
SA_Result | Returns operation result info |
SetCategory(ISN_AVAudioSessionCategory, ISN_AVAudioSessionCategoryOptions)
Sets the current audio session category.
The audio session's category defines how the app intends to use audio. Typically, you set the category before activating the session. You can also set the category while the session is active, but this results in an immediate route change.
Declaration
public static SA_Result SetCategory(ISN_AVAudioSessionCategory category, ISN_AVAudioSessionCategoryOptions options)
Parameters
Type | Name | Description |
---|---|---|
ISN_AVAudioSessionCategory | category | The audio session category to apply to the audio session. |
ISN_AVAudioSessionCategoryOptions | options | A mask of additional options for handling audio. For a list of constants, ISN_AVAudioSessionCategoryOptions |
Returns
Type | Description |
---|---|
SA_Result | Returns operation result info |
Events
AVAudioSessionInterruptionNotification
A notification that’s posted when an audio interruption occurs.
Starting in iOS 10, the system deactivates an app’s audio session when it suspends the app process. When the app starts running again, it receives an interruption notification that the system has deactivated its audio session. This notification is necessarily delayed in time because the system can only deliver it once the app is running again.
Declaration
public static event Action<ISN_AVAudioSessionInterruption> AVAudioSessionInterruptionNotification
Event Type
Type | Description |
---|---|
Action<ISN_AVAudioSessionInterruption> |