AudioEncoder

The AudioEncoder interface of the WebCodecs API encodes AudioData objects. Available only in secure contexts.

MDN Reference

Constructors

Link copied to clipboard
constructor(init: AudioEncoderInit)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The encodeQueueSize read-only property of the AudioEncoder interface returns the number of pending encode requests in the queue.

Link copied to clipboard

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

Functions

Link copied to clipboard
fun close()

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

Link copied to clipboard

The configure() method of the AudioEncoder interface enqueues a control message to configure the audio encoder for encoding chunks.

Link copied to clipboard
Link copied to clipboard
fun encode(data: AudioData)

The encode() method of the AudioEncoder interface enqueues a control message to encode a given AudioData object.

Link copied to clipboard
inline suspend fun AudioEncoder.flush()

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

Link copied to clipboard

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

Link copied to clipboard
fun reset()

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

Link copied to clipboard