EncodedAudioChunk Class

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

public sealed class EncodedAudioChunk

Constructors

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

EncodedAudioChunk(EncodedAudioChunkInit)

EncodedChunks.cs

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

public EncodedAudioChunk(EncodedAudioChunkInit init)

Parameters

init EncodedAudioChunkInit
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 EncodedAudioChunkType Type { get; }

Methods

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

CopyTo(Span<byte>)

EncodedChunks.cs

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

public void CopyTo(Span<byte> destination)

Parameters

destination Span<byte>
The buffer.

Exceptions

TypeErrorException
The buffer is smaller than the chunk.

See also