EncodedVideoChunk Class

A chunk of encoded video (https://w3c.github.io/webcodecs/#encodedvideochunk): the input of a VideoDecoder and the output of a VideoEncoder. Its bytes are immutable; it can be posted to a worker (serialized).

public sealed class EncodedVideoChunk

Constructors

NameDescription
EncodedVideoChunk(EncodedVideoChunkInit)Creates a chunk (https://w3c.github.io/webcodecs/#dom-encodedvideochunk-encodedvideochunk): the bytes are copied.

EncodedVideoChunk(EncodedVideoChunkInit)

EncodedChunks.cs

Creates a chunk (https://w3c.github.io/webcodecs/#dom-encodedvideochunk-encodedvideochunk): the bytes are copied.

public EncodedVideoChunk(EncodedVideoChunkInit init)

Parameters

init EncodedVideoChunkInit
The type, the timestamp and the bytes of the chunk.

Exceptions

DomException
A DataCloneError when the transfer list has a detached buffer or a buffer twice.

See also

Properties

NameDescription
ByteLengthGets the number of encoded bytes.
DataGets the encoded bytes.
DurationGets the presentation duration in microseconds, or null.
TimestampGets the presentation timestamp in microseconds.
TypeGets the type of the chunk.

Gets the number of encoded bytes.

public uint ByteLength { get; }

Gets the encoded bytes.

public ReadOnlyMemory<byte> Data { get; }

Property value

ReadOnlyMemory<byte>

Gets the presentation duration in microseconds, or null.

public ulong? Duration { get; }

Gets the presentation timestamp in microseconds.

public long Timestamp { get; }

Gets the type of the chunk.

public EncodedVideoChunkType Type { get; }

Methods

NameDescription
CopyTo(Span<byte>)Copies the encoded bytes into a buffer (https://w3c.github.io/webcodecs/#dom-encodedvideochunk-copyto).

CopyTo(Span<byte>)

EncodedChunks.cs

Copies the encoded bytes into a buffer (https://w3c.github.io/webcodecs/#dom-encodedvideochunk-copyto).

public void CopyTo(Span<byte> destination)

Parameters

destination Span<byte>
The buffer.

Exceptions

TypeErrorException
The buffer is smaller than the chunk.

See also