VideoEncoder

The VideoEncoder interface of the WebCodecs API encodes VideoFrame objects into EncodedVideoChunks. Available only in secure contexts.

MDN Reference

Constructors

Link copied to clipboard
constructor(init: VideoEncoderInit)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The encodeQueueSize read-only property of the VideoEncoder interface returns the number of pending encode requests in the queue.

Link copied to clipboard

The state read-only property of the VideoEncoder interface returns the current state of the underlying codec.

Functions

Link copied to clipboard
fun close()

The close() method of the VideoEncoder interface ends all pending work and releases system resources.

Link copied to clipboard

The configure() method of the VideoEncoder interface changes the VideoEncoder.state of the encoder to 'configured' and asynchronously prepares the encoder to accept VideoEncoders for encoding with the specified parameters.

Link copied to clipboard
Link copied to clipboard
fun encode(frame: VideoFrame, options: VideoEncoderEncodeOptions = definedExternally)

The encode() method of the VideoEncoder interface asynchronously encodes a VideoFrame.

Link copied to clipboard
suspend fun flush()

The flush() method of the VideoEncoder interface forces all pending encodes to complete.

Link copied to clipboard
Link copied to clipboard
fun reset()

The reset() method of the VideoEncoder interface synchronously cancels all pending encodes and callbacks, frees all underlying resources and sets the VideoEncoder.state to 'unconfigured'.

Link copied to clipboard