Skip to main content

WebCodecsDecoder

@3dverse/livelink v0.8.10


@3dverse/livelink / WebCodecsDecoder

Class: 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): WebCodecsDecoder

Defined in: livelink.js/sources/rendering/decoders/WebCodecsDecoder.ts:137

Create a new WebCodecsDecoder that will send the decoded frames to the given frame consumer.

Parameters

frame_consumer

The frame consumer that will receive the decoded frames

decoded_frame_consumer

DecodedFrameConsumer

Returns

WebCodecsDecoder

Overrides

EncodedFrameConsumer.constructor

Methods

_onFrameDecoded()

protected _onFrameDecoded(frame): void

Defined in: livelink.js/sources/rendering/decoders/EncodedFrameConsumer.ts:90

Must be called by the implementation as soon as the frame is decoded to update the cameras in the scene.

Parameters

frame

The decoded frame data

decoded_frame

OffscreenCanvas | VideoFrame

The decoded frame data

meta_data

FrameMetaData

The frame meta data

Returns

void

Inherited from

EncodedFrameConsumer._onFrameDecoded


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): Promise<EncodedFrameConsumer>

Defined in: livelink.js/sources/rendering/decoders/WebCodecsDecoder.ts:145

Configure the decoder with the codec and frame dimensions. This method replaces the constructor to allow for async initialization.

Parameters

__namedParameters
codec

CodecType

frame_dimensions

Vec2

Returns

Promise<EncodedFrameConsumer>

Overrides

EncodedFrameConsumer.configure


release()

release(): void

Defined in: livelink.js/sources/rendering/decoders/WebCodecsDecoder.ts:175

Release any resources used by the decoder.

Returns

void

Overrides

EncodedFrameConsumer.release


consumeEncodedFrame()

consumeEncodedFrame(params): void

Defined in: livelink.js/sources/rendering/decoders/WebCodecsDecoder.ts:187

Consume an encoded frame.

Parameters

params
encoded_frame

DataView

The encoded frame data

meta_data

FrameMetaData

The frame meta data

Returns

void

Overrides

EncodedFrameConsumer.consumeEncodedFrame