as

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

AudioRecordStreamBuilder

Required Privileges

The API requires specific privileges for certain operations:

[[needs.privilege]]
id = "com.amazon.audio.privilege.microphone.access"

Requires requesting run-time privileges.

Constructors

new AudioRecordStreamBuilder()

new AudioRecordStreamBuilder(): AudioRecordStreamBuilder

Returns

AudioRecordStreamBuilder

Properties

args

args: Object = {}

Methods

buildAsync()

buildAsync(): Promise<AudioRecordStream>

Creates a new using the current builder configuration. Must call and before building.

Returns

Promise<AudioRecordStream>

Promise A promise that resolves to:

  • New instance if successful

Or rejects with:

  • (-2): Missing required configuration
  • (-3): Audio system not initialized
  • (-9): Missing microphone privilege
  • (-1): Failed to allocate resources
  • (-5): Server communication error

destroyAsync()

static destroyAsync(recordStream: AudioRecordStream): Promise<AudioStatus>

Destroys an existing . This releases all resources associated with the stream. The stream object must not be used after calling this method.

Parameters

recordStream

AudioRecordStream

The stream to destroy

Returns

Promise<AudioStatus>

Promise A promise that resolves to:

  • (0): Stream destroyed successfully
  • (-2): Invalid stream object
  • (-3): Audio system not initialized
  • (-8): Stream already destroyed

reset()

reset(): void

Resets all builder configuration to default values.

Use this to reuse the builder for creating a different stream configuration.


setAudioConfig()

setAudioConfig(config: AudioConfig): void

Sets the audio configuration for the stream to be built. This must be called before .

Parameters

config

AudioConfig

Audio configuration object containing:

  • sampleRate: Sample rate in Hz from enum
  • channelMask: Channel configuration from enum
  • format: Sample format from enum

setAudioFlags()

setAudioFlags(flags: AudioFlags): void

Sets optional audio flags for the stream to be built. These flags modify the behavior of the audio recording.

Parameters

flags

AudioFlags

Bit flags from enum:

  • (0x0): Default behavior
  • (1 2): Minimize recording delay
  • (1 1): Hardware A/V synchronization And others as defined in enum Flags can be combined using bitwise OR

setAudioSource()

setAudioSource(source: AudioSource): void

Sets the audio source type for the stream to be built. This must be called before . Different sources may have different routing and processing applied.

Parameters

source

AudioSource

The type of audio input from enum:

  • : Optimized for speech recognition
  • : Optimized for VoIP
  • : Video recording audio
  • : Unprocessed audio input
  • : Wake word detection optimized
  • : High-frequency capture And others as defined in enum

Last updated: Jul 22, 2026