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 Playback Stream Builder allows for the configuration, creation, and destruction of Audio Playback Streams.
  • TOC

Required services

The API requires declaration of the system audio services:

Types Used

Refer to Audio core types
  • AudioStatus
  • AudioAttributes
  • AudioContentType
  • AudioUsageType
  • AudioFlags
  • AudioConfig
  • AudioSampleRate
  • AudioSampleFormat
  • AudioSource

Static Methods

AudioPlaybackStreamBuilder.destroyAsync(playbackStream)

Description

Destroys an AudioPlaybackStream object specified in the parameters.

Return Value

Returns a promise that resolves to an AudioStatus type.

Parameters

Example code

Methods

buildAsync()

Description

Creates a new AudioPlaybackStream object.

Return Value

Returns a promise that resolves to an AudioPlaybackStream object.

Example code

setAudioConfig(config)

Description

Sets the audio configuration for the playback stream.

Return Value

No return value.

Parameters

Example code

reset()

Description

Resets audio playback builder configuration.

Return Value

No return value.

Example code

setAudioAttributes(attributes)

Description

Sets audio playback builder attributes.

Return Value

No return value.

Parameters

Example code

setFramesPerBuffer(framesPerBuffer)

Description

Configures buffer the capacity for frame count in the shared memory buffer queue. This is used to determine the buffer size per slot in the shared memory buffer queue.

Return Value

No return value.

Parameters

Example code

setAudioFocusSessionId(focusSessionId)

Description

Sets the audio focus session id for the audio playback builder. The focus session id is obtained by creating an AudioFocusSession object and accessing it directly.

Return Value

No return value.

Parameters

Example code

Note: The above example assumes the session is an AudioFocusSession object.

setUnderrunThreshold(framesThreshold)

Description

Configure when audio server will report buffer underruns back to client.

Return Value

No return value.

Parameters

Example code

setDuckingPolicy(duckPolicy)

Description

Used to specify whether using explicitly ducking by app or using automatic ducking by system. If ducking policy equals to StreamDuckingPolicy::EXPLICIT, the app needs to call duckVolume API to duck the stream volume, otherwise the volume won’t be changed; If set to StreamDuckingPolicy::SYSTEM (by default), the stream volume ducking is handled by the system.

Return Value

No return value.

Parameters

Example code


Last modified on October 2, 2025