AudioDecoder.AudioDecoder()
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The AudioDecoder() constructor creates a new AudioDecoder object with the provided init.output callback assigned as the output callback, the provided init.error callback as the error callback, and the AudioDecoder.state set to "unconfigured".
Syntax
new AudioDecoder(init);
Parameters
init-
A dictionary object containing two required callbacks.
output-
A callback which is passed a single argument of an
AudioDataobject. error-
A callback which is passed a single argument of the error that has been thrown.
Examples
In the following example an AudioDecoder is created with the two required callback functions, one to deal with the decoded chunk and the other to handle errors.
const audioDecoder = new AudioDecoder({ output: processAudio, error: onEncoderError, });
Specifications
| Specification |
|---|
| WebCodecs # audiodecoder |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
AudioDecoder |
94 |
94 |
No |
No |
80 |
No |
94 |
94 |
No |
No |
No |
No |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/AudioDecoder/AudioDecoder