MDN self-hosted library · e01.org

AudioEncoder: encode() method

WebCodecs APIwindowanddedicated

WebCodecs APIwindow_and_dedicated

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

Syntax

encode(data)

Parameters

  • data
  • : An AudioData object.

Return value

None (undefined).

Exceptions

  • InvalidStateError DOMException
  • : Thrown if the state is not "configured".
  • TypeError
  • : Thrown if the AudioData object has been transferred.

Examples

In the following example encode is passed an AudioData object.

encoder.encode(data);

Specifications

Browser compatibility