AudioEncoder: encode() method
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
Note: This feature is available inDedicated Web Workers.
Theencode() method of theAudioEncoder interface enqueues a control message to encode a givenAudioData object.
In this article
Syntax
js
encode(data)Parameters
Return value
None (undefined).
Exceptions
InvalidStateErrorDOMExceptionThrown if the
stateis not"configured".TypeErrorThrown if the
AudioDataobject has beentransferred.
Examples
In the following exampleencode is passed anAudioData object.
js
encoder.encode(data);Specifications
| Specification |
|---|
| WebCodecs> # dom-audioencoder-encode> |