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
AudioDataobject.
Return Value
Exceptions
InvalidStateErrorDOMException-
Thrown if the
stateis not"configured". TypeErrorDOMException-
Thrown if the
AudioDataobject 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