AudioEncoder.encode()

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

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

Syntax

AudioEncoder.encode(data);

Parameters

data

An AudioData object.

Return Value

Undefined.

Exceptions

InvalidStateError DOMException

Thrown if the state is not "configured".

TypeError DOMException

Thrown if the AudioData object has been transferred.

Examples

In the following example encode is passed an AudioData object.

encoder.encode(data);

Specifications

Specification
WebCodecs
# dom-audioencoder-encode

Browser compatibility

BCD tables only load in the browser