Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Dedicated Web Workers.
The encode() method of the AudioEncoder interface enqueues a control message to encode a given AudioData object.
encode(data)dataAn AudioData object.
None (undefined).
InvalidStateError DOMExceptionThrown if the state is not "configured".
TypeErrorThrown if the AudioData object has been transferred.
In the following example encode is passed an AudioData object.
encoder.encode(data);