files/en-us/web/api/audiodecoder/configure/index.md
{{securecontext_header}}{{APIRef("WebCodecs API")}}{{AvailableInWorkers("window_and_dedicated")}}
The configure() method of the {{domxref("AudioDecoder")}} interface enqueues a control message to configure the audio decoder for decoding chunks.
configure(config)
config
codec
sampleRate
numberOfChannels
description {{optional_inline}}
[!NOTE] The registrations in the WebCodecs Codec Registry link to a specification detailing whether and how to populate the optional
descriptionmember.
None ({{jsxref("undefined")}}).
config is invalid.InvalidStateError {{domxref("DOMException")}}
"closed".NotSupportedError {{domxref("DOMException")}}
config is valid but the user agent cannot provide a codec that can decode this profile.The following example configures the audioDecoder with the opus codec.
audioDecoder.configure({
codec: "opus",
sampleRate: 44100,
numberOfChannels: 2,
});
{{Specifications}}
{{Compat}}