AudioDecoder

The AudioDecoder interface of the WebCodecs API decodes chunks of audio. Available only in secure contexts.

MDN Reference

Constructors

Link copied to clipboard
constructor(init: AudioDecoderInit)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
external val decodeQueueSize: Int

The decodeQueueSize read-only property of the AudioDecoder interface returns the number of pending decode requests in the queue.

Link copied to clipboard
Link copied to clipboard
external val state: CodecState

The state read-only property of the AudioDecoder interface returns the current state of the underlying codec.

Functions

Link copied to clipboard
external fun close()

The close() method of the AudioDecoder interface ends all pending work and releases system resources.

Link copied to clipboard
external fun configure(config: AudioDecoderConfig)

The configure() method of the AudioDecoder interface enqueues a control message to configure the audio decoder for decoding chunks.

Link copied to clipboard
external fun decode(chunk: EncodedAudioChunk)

The decode() method of the AudioDecoder interface enqueues a control message to decode a given chunk of audio.

Link copied to clipboard
open external fun dispatchEvent(event: Event): Boolean
Link copied to clipboard
inline suspend fun AudioDecoder.flush()

The flush() method of the AudioDecoder interface returns a Promise that resolves once all pending messages in the queue have been completed.

Link copied to clipboard
external fun flushAsync(): Promise<Void>

The flush() method of the AudioDecoder interface returns a Promise that resolves once all pending messages in the queue have been completed.

Link copied to clipboard
external fun reset()

The reset() method of the AudioDecoder interface resets all states including configuration, control messages in the control message queue, and all pending callbacks.

Link copied to clipboard
external fun <T : Event> when(type: EventType<T>, options: ObservableEventListenerOptions?): Observable<T>