AudioDecoder Class
Decodes audio (https://w3c.github.io/webcodecs/#audiodecoder-interface): the EncodedAudioChunk objects given to AudioDecoder.Decode are decoded by the codecs of BrowsingContextOptions.MediaCodecs, and the AudioData objects are given to the output callback.
public sealed class AudioDecoder : EventTarget- Inheritance
EventTargetAudioDecoder
Constructors
| Name | Description |
|---|---|
| AudioDecoder(AudioDecoderInit) | Creates a decoder (https://w3c.github.io/webcodecs/#dom-audiodecoder-audiodecoder). |
AudioDecoder(AudioDecoderInit)
Codecs.csCreates a decoder (https://w3c.github.io/webcodecs/#dom-audiodecoder-audiodecoder).
public AudioDecoder(AudioDecoderInit init)Properties
| Name | Description |
|---|---|
| DecodeQueueSize | Gets the number of pending decode requests. |
| OnDequeue | Gets or sets the event handler of the dequeue event (the queue size decreased). |
| State | Gets the state of the decoder. |
DecodeQueueSize
Codecs.csGets the number of pending decode requests.
public uint DecodeQueueSize { get; }OnDequeue
Codecs.csGets or sets the event handler of the dequeue event (the queue size decreased).
State
Codecs.csGets the state of the decoder.
public CodecState State { get; }Methods
| Name | Description |
|---|---|
| Close() | Closes the decoder (https://w3c.github.io/webcodecs/#dom-audiodecoder-close). |
| Configure(AudioDecoderConfig) | Configures the decoder (https://w3c.github.io/webcodecs/#dom-audiodecoder-configure): a configuration that the codecs do not support closes it with a NotSupportedError. |
| Decode(EncodedAudioChunk) | Decodes a chunk (https://w3c.github.io/webcodecs/#dom-audiodecoder-decode). |
| Flush() | Decodes the pending chunks (https://w3c.github.io/webcodecs/#dom-audiodecoder-flush): the promise resolves once their outputs are delivered. |
| IsConfigSupported(AudioDecoderConfig) | Returns whether the codecs support a configuration (https://w3c.github.io/webcodecs/#dom-audiodecoder-isconfigsupported). |
| Reset() | Discards the pending chunks and the configuration (https://w3c.github.io/webcodecs/#dom-audiodecoder-reset). |
Close()
Codecs.csCloses the decoder (https://w3c.github.io/webcodecs/#dom-audiodecoder-close).
public void Close()Configure(AudioDecoderConfig)
Codecs.csConfigures the decoder (https://w3c.github.io/webcodecs/#dom-audiodecoder-configure): a configuration that the codecs do not support closes it with a NotSupportedError.
public void Configure(AudioDecoderConfig config)Parameters
configAudioDecoderConfig- The configuration.
Exceptions
TypeErrorException- The configuration is invalid.
DomException- An
InvalidStateErrorwhen the decoder is closed.
See also
Decode(EncodedAudioChunk)
Codecs.csDecodes a chunk (https://w3c.github.io/webcodecs/#dom-audiodecoder-decode).
public void Decode(EncodedAudioChunk chunk)Parameters
chunkEncodedAudioChunk- The chunk.
Exceptions
DomException- An
InvalidStateErrorwhen the decoder is not configured, aDataErrorwhen a key chunk is required.
See also
Flush()
Codecs.csDecodes the pending chunks (https://w3c.github.io/webcodecs/#dom-audiodecoder-flush): the promise resolves once their outputs are delivered.
public Task Flush()IsConfigSupported(AudioDecoderConfig)
Codecs.csReturns whether the codecs support a configuration (https://w3c.github.io/webcodecs/#dom-audiodecoder-isconfigsupported).
public static Task<AudioDecoderSupport> IsConfigSupported(AudioDecoderConfig config)Parameters
configAudioDecoderConfig- The configuration.
Returns
Task<AudioDecoderSupport> A task that completes with the support and the configuration with the recognized members, or fails with a TypeErrorException for an invalid configuration.
See also
Reset()
Codecs.csDiscards the pending chunks and the configuration (https://w3c.github.io/webcodecs/#dom-audiodecoder-reset).
public void Reset()