CanvasSinkOptions
Options for constructing a CanvasSink.
type CanvasSinkOptions = {
width?: number;
height?: number;
fit?: 'fill' | 'contain' | 'cover';
rotation?: Rotation;
poolSize?: number;
};
See Rotation
.
Used by
Properties
width
width?: number;
The width of the output canvas in pixels, defaulting to the display width of the video track. If height is not set, it will be deduced automatically based on aspect ratio.
height
height?: number;
The height of the output canvas in pixels, defaulting to the display height of the video track. If width is not set, it will be deduced automatically based on aspect ratio.
fit
fit?: 'fill' | 'contain' | 'cover';
The fitting algorithm in case both width and height are set.
'fill'
will stretch the image to fill the entire box, potentially altering aspect ratio.'contain'
will contain the entire image within the box while preserving aspect ratio. This may lead to letterboxing.'cover'
will scale the image until the entire box is filled, while preserving aspect ratio.
rotation
rotation?: Rotation;
The clockwise rotation by which to rotate the raw video frame. Defaults to the rotation set in the file metadata. Rotation is applied before resizing.
See Rotation
.
poolSize
poolSize?: number;
When set, specifies the number of canvases in the pool. These canvases will be reused in a ring buffer / round-robin type fashion. This keeps the amount of allocated VRAM constant and relieves the browser from constantly allocating/deallocating canvases. A pool size of 0 or undefined
disables the pool and means a new canvas is created each time.