Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content
Audio Focus Session allows audio focus management such as requesting audio focus and releasing audio focus. Audio Focus session is used by playback streams to request audio focus or release audio focus. A playback stream builder can specify an audio focus session to use by using playback stream builder’s setAudioFocusSessionId.

Required services

The API requires declaration of the system audio service:

Types Used

Refer to Audio core types
  • AudioFocusAttributes
  • AudioFocusStatus
  • AudioFocusChange

Methods

requestAudioFocusAsync(attr)

Description

Requests audio focus in the session with the selected audio usage type.

Return Value

Returns a promise resolving to a AudioFocusStatus type.

Parameters

Example code

releaseAudioFocusAsync()

Description

Releases audio focus in the session.

Return Value

Returns a promise resolving to a AudioFocusStatus type.

Example code

registerAudioFocusListenerAsync(callback)

Description

Registers a callback function that executes anytime an audio focus event is detected. Only one callback function can be registered at a time.

Return Value

Returns a promise that resolves to an AudioFocusStatus type.

Parameters

Example code

unregisterAudioFocusListenerAsync()

Description

Unregisters any callback function that is currently registered for audio focus.

Return Value

Returns a promise that resolves to an AudioFocusStatus type.

Example code

getAudioSessionId()

Description

Gets the value of the member variable sessionId, which represents the session id for a given focus session.

Return Value

Returns a number representing the session id.

Example code

getUsage()

Description

Gets audio focus usage value

Return Value

Returns a number representing the audio focus usage.

Example code


Last modified on October 2, 2025