as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

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