AudioRecordStream
Constructors
new AudioRecordStream()
new AudioRecordStream(
id): AudioRecordStream
Parameters
id
number
Internal stream identifier
Returns
Properties
streamId
streamId:
number
Methods
flushAsync()
flushAsync():
Promise<AudioStatus>
Flushes the record buffer, discarding any unread data.
Returns
Promise<AudioStatus>
Promise A promise that resolves to:
STATUS_NO_ERROR (0): Successfully flushedSTATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
getAudioConfigAsync()
getAudioConfigAsync():
Promise<AudioConfig>
Retrieves the current audio configuration of the record stream.
Returns
Promise<AudioConfig>
Promise A promise that resolves to an object containing:
sampleRate: Current sample rate in HzchannelMask: Current channel configurationformat: Current sample format Or rejects with:STATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
getAudioEffectSessionIdAsync()
getAudioEffectSessionIdAsync():
Promise<Int32>
Gets the custom audio effect session ID associated with this stream.
Returns
Promise<Int32>
Promise A promise that resolves to:
- Positive value: The effect session ID
STATUS_NO_INIT (-3): Stream not initializedSTATUS_BAD_VALUE (-2): No effect session assigned
getAudioFlagsAsync()
getAudioFlagsAsync():
Promise<Int32>
Gets the audio flags configured for this stream.
Returns
Promise<Int32>
Promise A promise that resolves to:
- Bitwise combination of AudioFlags values
STATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
getAudioSourceAsync()
getAudioSourceAsync():
Promise<AudioSource>
Gets the audio source type configured for this stream.
Returns
Promise<AudioSource>
Promise A promise that resolves to:
- enum value indicating the current source Or rejects with:
STATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
getChannelCountAsync()
getChannelCountAsync():
Promise<Int32>
Gets the channel count of the record stream.
Returns
Promise<Int32>
Promise A promise that resolves to:
- Positive value: Number of channels
STATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
getLatencyInMsAsync()
getLatencyInMsAsync():
Promise<Int32>
Gets the current latency of the record stream in milliseconds.
Returns
Promise<Int32>
Promise A promise that resolves to:
- Positive value: Latency in milliseconds
STATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
getMajorVersion()
staticgetMajorVersion():number
Gets the major version number of the implementation. Can be used to make version checks.
Returns
number
number The major version number
getMinBufferSizeInBytesAsync()
getMinBufferSizeInBytesAsync():
Promise<Int32>
Gets the minimum buffer size required for recording. calls must use at least this size for reliable recording.
Returns
Promise<Int32>
Promise A promise that resolves to:
- Positive value: Minimum buffer size in bytes
STATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
getMinorVersion()
staticgetMinorVersion():number
Gets the minor version number of the implementation. Can be used to make version checks.
Returns
number
number The minor version number
getNumBytesInPipelineAsync()
getNumBytesInPipelineAsync():
Promise<Int32>
Gets the number of bytes currently in the recording pipeline.
Returns
Promise<Int32>
Promise A promise that resolves to:
- Positive value: Number of bytes in pipeline
STATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
getNumBytesOfNativeBufferAsync()
getNumBytesOfNativeBufferAsync():
Promise<Int32>
Gets the size of the native buffer used for recording. This represents the maximum amount of data that can be buffered.
Returns
Promise<Int32>
Promise A promise that resolves to:
- Positive value: Buffer size in bytes
STATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
getPatchVersion()
staticgetPatchVersion():number
Gets the patch version number of the implementation. Can be used to make version checks.
Returns
number
number The patch version number
getSampleRateAsync()
getSampleRateAsync():
Promise<Int32>
Gets the sample rate of the record stream.
Returns
Promise<Int32>
Promise A promise that resolves to:
- Positive value: Sample rate in Hz
STATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
getSampleSizeAsync()
getSampleSizeAsync():
Promise<Int32>
Gets the sample size in bits of the record stream.
Returns
Promise<Int32>
Promise A promise that resolves to:
- Positive value: Sample size in bits (e.g., 16, 24, 32)
STATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
initCheckAsync()
initCheckAsync():
Promise<AudioStatus>
Verifies if the record stream has been properly initialized. Must be called before using other methods to ensure the stream is ready.
Returns
Promise<AudioStatus>
Promise A promise that resolves to:
STATUS_NO_ERROR (0): Stream is properly initializedSTATUS_NO_INIT (-3): Stream not initializedSTATUS_DEAD_OBJECT (-5): Server communication error
readAsync()
readAsync(bytes:
Int32):Promise<ArrayBuffer>
Reads audio data from the record stream.
Requires privilege: com.amazon.audio.privilege.microphone.access
Parameters
bytes
Int32
Number of bytes to read. Must be at least the value returned by
Returns
Promise<ArrayBuffer>
Promise A promise that resolves to:
- ArrayBuffer containing the recorded audio data Or rejects with:
STATUS_NO_INIT (-3): Stream not initializedSTATUS_BAD_VALUE (-2): Invalid bytes parameterSTATUS_PERMISSION_DENIED (-9): Missing microphone privilegeSTATUS_INVALID_OPERATION (-8): Read operation failedSTATUS_DEAD_OBJECT (-5): Server communication error
registerEventObserverAsync()
registerEventObserverAsync(callback:
(value: any) => void):Promise<AudioStatus>
Registers a callback to receive record stream events. Only one callback can be registered at a time.
Parameters
callback
(value: any) => void
Function to receive events. Events include:
DIED (0): Stream has failedRECOVERED (1): Stream has recovered from failureMUTE_STATE_CHANGED (2): Stream mute state changed
Returns
Promise<AudioStatus>
Promise A promise that resolves to:
STATUS_NO_ERROR (0): Callback registered successfullySTATUS_NO_INIT (-3): Stream not initializedSTATUS_BAD_VALUE (-2): Invalid callbackSTATUS_ALREADY_EXISTS (-4): Callback already registered
unregisterEventObserverAsync()
unregisterEventObserverAsync():
Promise<AudioStatus>
Unregister the previously registered event callback.
Returns
Promise<AudioStatus>
Promise A promise that resolves to:
STATUS_NO_ERROR (0): Callback unregistered successfullySTATUS_NO_INIT (-3): Stream not initializedSTATUS_BAD_VALUE (-2): No callback was registered
Last updated: Jul 22, 2026

