Audio Focus Manager
Audio Focus Manager allows the creation and destruction of Audio Focus Sessions. Specifically, it prevent multiple audio sources from playing at the same time by letting one audio source play normally while lowering the volume (also known as ducking), pausing, or stopping other audio sources.
- TOC
Required services
The API requires declaration of the system audio service:
[wants]
[[wants.service]]
id = "com.amazon.audio.control"
Types Used
Refer to Audio core types
AudioFocusStatus
Static Methods
AudioFocusManager.createAudioFocusSessionAsync()
Description
Creates a new audio focus session.
Return Value
Returns a promise resolving to an AudioFocusSession object.
Example code
/*
returns AudioFocusSession object after promise resolves
*/
const session = AudioFocusManager.createAudioFocusSessionAsync()
.then((session) => {return session;}).catch((error) => console.log(error));
AudioFocusManager.destroyAudioFocusSessionAsync(sessionObject)
Description
Destroys the Audio Focus Session specified in the parameter.
Return Value
Returns a promise that resolves to a AudioFocusStatus type.
Parameters
Parameter Name | Type | Required | Description |
---|---|---|---|
sessionObject | AudioFocusSession | Yes | AudioFocusSession object to destroy |
Example code
/*
Assume session is an AudioFocusSession object
Detroys session and returns a promise resolving to a AudioFocusStatus type
*/
const status = AudioFocusManager.destroyAudioFocusSessionAsync(session)
.then((status) => {return status;}).catch((error) => console.log(error));
AudioFocusManager.getDefaultAudioFocusSessionAsync()
Description
Gets the default audio focus session. The default audio focus session is a singleton instance that is defaulted to if an audio stream does not link an audio focus session explicitly.
Return Value
Returns a promise resolving to the default AudioFocusSession object.
Example code
/*
returns default AudioFocusSession object after promise resolves
*/
const session = AudioFocusManager.getDefaultAudioFocusSessionAsync()
.then((session) => {return session;}).catch((error) => console.log(error));
Last updated: Oct 02, 2025