WebCodecsDecoder
Defined in: livelink.js/sources/rendering/decoders/WebCodecsDecoder.ts:21
A decoder that uses the WebCodecs API to decode video frames.
This decoder is hardware accelerated (if supported) and is the most efficient way to decode video frames.
This decoder is only available in browsers that support the WebCodecs API.
See
https://developer.mozilla.org/en-US/docs/Web/API/WebCodecs_API
Extends
Constructors
new WebCodecsDecoder()
new WebCodecsDecoder(frame_consumer: {
decoded_frame_consumer: DecodedFrameConsumer;
}): WebCodecsDecoder
Defined in: livelink.js/sources/rendering/decoders/WebCodecsDecoder.ts:142
Create a new WebCodecsDecoder that will send the decoded frames to the given frame consumer.
Parameters
Parameter | Type | Description |
---|---|---|
frame_consumer | { decoded_frame_consumer : DecodedFrameConsumer ; } | The frame consumer that will receive the decoded frames |
frame_consumer.decoded_frame_consumer | DecodedFrameConsumer | - |
Returns
Overrides
EncodedFrameConsumer
.constructor
Methods
findSupportedCodec()
static findSupportedCodec(): Promise<null | CodecType>
Defined in: livelink.js/sources/rendering/decoders/WebCodecsDecoder.ts:35
Find a supported codec that can be decoded by the WebCodecs API.
This method can be used to check if the WebCodecs API is supported by the browser.
If the WebCodecs API is not supported, this method will return null.
If the WebCodecs API is supported, this method will return the best codec that is supported by the browser.
If no codec is supported by the browser, this method will return null.
Returns
Promise
<null
| CodecType
>
The codec that is supported by the browser, or null if the WebCodecs API is not supported or no codec is supported by the browser.
configure()
configure(__namedParameters: {
codec: CodecType;
frame_dimensions: Vec2;
}): Promise<EncodedFrameConsumer>
Defined in: livelink.js/sources/rendering/decoders/WebCodecsDecoder.ts:150
Configure the decoder with the codec and frame dimensions. This method replaces the constructor to allow for async initialization.
Parameters
Parameter | Type |
---|---|
__namedParameters | { codec : CodecType ; frame_dimensions : Vec2 ; } |
__namedParameters.codec | CodecType |
__namedParameters.frame_dimensions | Vec2 |
Returns
Promise
<EncodedFrameConsumer
>
Overrides
EncodedFrameConsumer
.configure
resize()
resize(__namedParameters: {
frame_dimensions: Vec2;
}): void
Defined in: livelink.js/sources/rendering/decoders/WebCodecsDecoder.ts:183
Parameters
Parameter | Type |
---|---|
__namedParameters | { frame_dimensions : Vec2 ; } |
__namedParameters.frame_dimensions | Vec2 |
Returns
void
Overrides
release()
release(): void
Defined in: livelink.js/sources/rendering/decoders/WebCodecsDecoder.ts:195
Release any resources used by the decoder.
Returns
void
Overrides
consumeEncodedFrame()
consumeEncodedFrame(params: {
encoded_frame: DataView;
meta_data: FrameMetaData;
}): void
Defined in: livelink.js/sources/rendering/decoders/WebCodecsDecoder.ts:207
Consume an encoded frame.
Parameters
Parameter | Type | Description |
---|---|---|
params | { encoded_frame : DataView ; meta_data : FrameMetaData ; } | |
params.encoded_frame | DataView | The encoded frame data |
params.meta_data | FrameMetaData | The frame meta data |
Returns
void