VideoDecoder Class
Decodes video (https://w3c.github.io/webcodecs/#videodecoder-interface): the EncodedVideoChunk objects given to VideoDecoder.Decode are decoded by the codecs of BrowsingContextOptions.MediaCodecs, and the VideoFrame objects are given to the output callback, with the orientation, the display aspect ratio and the color space of the configuration.
public sealed class VideoDecoder : EventTarget- Inheritance
EventTargetVideoDecoder
Constructors
| Name | Description |
|---|---|
| VideoDecoder(VideoDecoderInit) | Creates a decoder (https://w3c.github.io/webcodecs/#dom-videodecoder-videodecoder). |
VideoDecoder(VideoDecoderInit)
Codecs.csCreates a decoder (https://w3c.github.io/webcodecs/#dom-videodecoder-videodecoder).
public VideoDecoder(VideoDecoderInit 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-videodecoder-close). |
| Configure(VideoDecoderConfig) | Configures the decoder (https://w3c.github.io/webcodecs/#dom-videodecoder-configure): a configuration that the codecs do not support closes it with a NotSupportedError. |
| Decode(EncodedVideoChunk) | Decodes a chunk (https://w3c.github.io/webcodecs/#dom-videodecoder-decode). |
| Flush() | Decodes the pending chunks (https://w3c.github.io/webcodecs/#dom-videodecoder-flush): the promise resolves once their frames are delivered. |
| IsConfigSupported(VideoDecoderConfig) | Returns whether the codecs support a configuration (https://w3c.github.io/webcodecs/#dom-videodecoder-isconfigsupported). |
| Reset() | Discards the pending chunks and the configuration (https://w3c.github.io/webcodecs/#dom-videodecoder-reset). |
Close()
Codecs.csCloses the decoder (https://w3c.github.io/webcodecs/#dom-videodecoder-close).
public void Close()Configure(VideoDecoderConfig)
Codecs.csConfigures the decoder (https://w3c.github.io/webcodecs/#dom-videodecoder-configure): a configuration that the codecs do not support closes it with a NotSupportedError.
public void Configure(VideoDecoderConfig config)Parameters
configVideoDecoderConfig- The configuration.
Exceptions
TypeErrorException- The configuration is invalid.
DomException- An
InvalidStateErrorwhen the decoder is closed.
See also
Decode(EncodedVideoChunk)
Codecs.csDecodes a chunk (https://w3c.github.io/webcodecs/#dom-videodecoder-decode).
public void Decode(EncodedVideoChunk chunk)Parameters
chunkEncodedVideoChunk- 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-videodecoder-flush): the promise resolves once their frames are delivered.
public Task Flush()IsConfigSupported(VideoDecoderConfig)
Codecs.csReturns whether the codecs support a configuration (https://w3c.github.io/webcodecs/#dom-videodecoder-isconfigsupported).
public static Task<VideoDecoderSupport> IsConfigSupported(VideoDecoderConfig config)Parameters
configVideoDecoderConfig- The configuration.
Returns
Task<VideoDecoderSupport> 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-videodecoder-reset).
public void Reset()