Path: blob/main/files/en-us/web/api/audiodecoder/decode/index.md
6510 views
------{{securecontext_header}}{{APIRef("WebCodecs API")}}{{SeeCompatTable}}
The decode() method of the {{domxref("AudioDecoder")}} interface enqueues a control message to decode a given chunk of audio.
Syntax
Parameters
chunk: An {{domxref("EncodedAudioChunk")}} object representing a chunk of encoded audio.
Return value
None ({{jsxref("undefined")}}).
Exceptions
InvalidStateError{{domxref("DOMException")}}: Thrown if the {{domxref("AudioDecoder.state","state")}} is not
"configured".
DataError{{domxref("DOMException")}}: Thrown if the
chunkis unable to be decoded due to relying on other frames for decoding.
Examples
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}