Constructors
new AudioFocusManager()
new AudioFocusManager():AudioFocusManager
Returns
AudioFocusManager
Properties
defaultFocusSession
static defaultFocusSession: AudioFocusSession = null
Methods
createAudioFocusSessionAsync()
static createAudioFocusSessionAsync(): Promise<AudioFocusSession>
Creates a new AudioFocusSession.
Each session can independently manage audio focus requests and callbacks.
Multiple sessions can be created to manage different audio streams independently.
Example use cases:
- Different sessions for music playback and navigation
- Separate session for voice assistant responses
- Independent session for game audio
Returns
Promise<AudioFocusSession>
A promise that resolves to:
- New AudioFocusSession object if successful
STATUS_NO_MEMORY (-1): Failed to allocate sessionSTATUS_NO_INIT (-3): Audio focus system not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
destroyAudioFocusSessionAsync()
static destroyAudioFocusSessionAsync(sessionObject): Promise<AudioFocusStatus>
Destroys an existing audio focus session and releases all associated resources.
This must be called when the session is no longer needed to free up system resources.
Any active focus requests in this session will be automatically released.
Important: Do not attempt to use the session object after destroying it.
Parameters
sessionObject
AudioFocusSession
The session to destroy
Returns
Promise<AudioFocusStatus>
A promise that resolves to:
AUDIO_FOCUS_STATUS_NO_ERROR (0): Session destroyed successfullyAUDIO_FOCUS_STATUS_BAD_VALUE (-2): Invalid session objectAUDIO_FOCUS_STATUS_NO_INIT (-3): Audio focus system not initializedAUDIO_FOCUS_STATUS_INVALID_OPERATION (-8): Session already destroyed
getDefaultAudioFocusSessionAsync()
static getDefaultAudioFocusSessionAsync(): Promise<AudioFocusSession>
Gets the default audio focus session.
This is a singleton instance that is used when an audio stream doesn’t explicitly
specify a focus session. The default session is created on first access and
persists until the application terminates.
Important notes:
- The default session is shared across all components using default focus
- Focus changes in the default session affect all streams using it
- For independent focus control, create dedicated sessions instead
Returns
Promise<AudioFocusSession>
A promise that resolves to:
- The default AudioFocusSession instance Or rejects with:
STATUS_NO_MEMORY (-1): Failed to create default sessionSTATUS_NO_INIT (-3): Audio focus system not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
getMajorVersion()
static getMajorVersion(): number
Gets the major version number of the AudioFocusManager.
Can be used for compatibility checking and feature detection.
Returns
number
The major version number of the module
getMinorVersion()
static getMinorVersion(): number
Gets the minor version number of the AudioFocusManager.
Can be used for compatibility checking and feature detection.
Returns
number
The minor version number of the module
getPatchVersion()
static getPatchVersion(): number
Gets the patch version number of the AudioFocusManager.
Can be used for compatibility checking and feature detection.
Returns
number
The patch version number of the module

