Skip to content

Snapshoter

Snapshot helper

Takes a snapshot of the ResponsiveCanvas backing a CanvasRenderer. In general, ResponsiveCanvas is multi-layer therefore two capturing modes are available: capture all layers separately or merge them into one image. When you call snapshot() method Snapshoter waits for the next render update and makes a copy of all canvas layers. There’re several modes for the resolution of the snapshot: “video” - snapshot has the same size as the video stream, “max”/“min” - in maximum/minimum size among canvas layers.

new Snapshoter(renderer, mirror, sizeMode, sizeMax?): Snapshoter

Constructor

CanvasRenderer

Renderer to take snapshot of

boolean = false

Mirror captured images

Video size mode

"video" | "max" | "min"

number

Maximum video size

Snapshoter

protected mirror: boolean = false

Mirror captured images


protected renderer: CanvasRenderer

Renderer to take snapshot of


protected optional sizeMax: number

Maximum video size


protected sizeMode: "video" | "max" | "min" = "video"

Video size mode

snapshot(): Promise<undefined | ImageData>

Take snapshot of the renderer

Enqueues capture after the next renderer update. All canvas layers are merged into one final image.

Promise<undefined | ImageData>

Promise resolved to the merged captured image


snapshotLayers(): Promise<(undefined | ImageData)[]>

Take snapshot of the renderer

Enqueues capture after the next renderer update. All canvas layers are returned as separate images.

Promise<(undefined | ImageData)[]>

Promise resolved to the array of captured images