as

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

AudioRecordStreamBuilder

Constructors

new AudioRecordStreamBuilder()

new AudioRecordStreamBuilder(): AudioRecordStreamBuilder

Returns

AudioRecordStreamBuilder

Properties

args

args: Object = {}

Methods

buildAsync()

buildAsync(): Promise<AudioRecordStream>

Creates a new AudioRecordStream using the current builder configuration. Must call setAudioConfig and setAudioSource before building. Requires privilege: com.amazon.audio.privilege.microphone.access Requires runtime privilege:

Returns

Promise<AudioRecordStream>

A promise that resolves to:

Or rejects with:

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

See

https://developer.integ.amazon.com/docs/kepler-tv/request-runtime-privileges.html


reset()

reset(): void

Resets all builder configuration to default values.

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

Returns

void


setAudioConfig()

setAudioConfig(config): void

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

Parameters

config

AudioConfig

Audio configuration object containing:

  • sampleRate: Sample rate in Hz from types/AudioCoreClientTypes.AudioSampleRate enum
  • channelMask: Channel configuration from types/AudioCoreClientTypes.AudioChannelMask enum
  • format: Sample format from types/AudioCoreClientTypes.AudioSampleFormat enum

Returns

void


setAudioFlags()

setAudioFlags(flags): 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 AudioFlags enum:

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

Returns

void


setAudioSource()

setAudioSource(source): void

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

Parameters

source

AudioSource

The type of audio input from AudioSource enum:

  • VOICE_RECOGNITION: Optimized for speech recognition
  • VOICE_COMMUNICATION: Optimized for VoIP
  • CAMCORDER: Video recording audio
  • RAW: Unprocessed audio input
  • WAKEWORD: Wake word detection optimized
  • ULTRASOUND: High-frequency capture And others as defined in AudioSource enum

Returns

void


destroyAsync()

static destroyAsync(recordStream): Promise<AudioStatus>

Destroys an existing AudioRecordStream. 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>

A promise that resolves to:

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

Last updated: Oct 02, 2025