Skip to content
Class

VideoSampleSource ​

This source can be used to add raw, unencoded video samples (frames) to an output video track. These frames will automatically be encoded and then piped into the output.

Extends: VideoSource

Constructor ​

ts
constructor(
	encodingConfig: VideoEncodingConfig,
): VideoSampleSource;

Creates a new VideoSampleSource whose samples are encoded according to the specified VideoEncodingConfig.

Methods ​

add() ​

ts
add(
	videoSample: VideoSample,
	encodeOptions?: VideoEncoderEncodeOptions,
): Promise<void>;

Encodes a video sample (frame) and then adds it to the output.

Returns: A Promise that resolves once the output is ready to receive more samples. You should await this Promise to respect writer and encoder backpressure.

See VideoSample.

Released under the Mozilla Public License 2.0.