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 EncodedAudioChunkConstructors
| Name | Description |
|---|---|
| EncodedAudioChunk(EncodedAudioChunkInit) | Creates a chunk (https://w3c.github.io/webcodecs/#dom-encodedaudiochunk-encodedaudiochunk): the bytes are copied. |
EncodedAudioChunk(EncodedAudioChunkInit)
EncodedChunks.csCreates a chunk (https://w3c.github.io/webcodecs/#dom-encodedaudiochunk-encodedaudiochunk): the bytes are copied.
public EncodedAudioChunk(EncodedAudioChunkInit init)Parameters
initEncodedAudioChunkInit- The type, the timestamp and the bytes of the chunk.
Exceptions
DomException- A
DataCloneErrorwhen the transfer list has a detached buffer or a buffer twice.
See also
Properties
| Name | Description |
|---|---|
| ByteLength | Gets the number of encoded bytes. |
| Data | Gets the encoded bytes. |
| Duration | Gets the presentation duration in microseconds, or null. |
| Timestamp | Gets the presentation timestamp in microseconds. |
| Type | Gets the type of the chunk. |
ByteLength
EncodedChunks.csGets the number of encoded bytes.
public uint ByteLength { get; }Data
EncodedChunks.csDuration
EncodedChunks.csGets the presentation duration in microseconds, or null.
public ulong? Duration { get; }Timestamp
EncodedChunks.csGets the presentation timestamp in microseconds.
public long Timestamp { get; }Type
EncodedChunks.csMethods
| Name | Description |
|---|---|
| CopyTo(Span<byte>) | Copies the encoded bytes into a buffer (https://w3c.github.io/webcodecs/#dom-encodedaudiochunk-copyto). |
CopyTo(Span<byte>)
EncodedChunks.csCopies the encoded bytes into a buffer (https://w3c.github.io/webcodecs/#dom-encodedaudiochunk-copyto).
Parameters
destinationSpan<byte>- The buffer.
Exceptions
TypeErrorException- The buffer is smaller than the chunk.