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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Snapshoter(
renderer,mirror,sizeMode,sizeMax?):Snapshoter
Constructor
Parameters
Section titled “Parameters”renderer
Section titled “renderer”Renderer to take snapshot of
mirror
Section titled “mirror”boolean = false
Mirror captured images
sizeMode
Section titled “sizeMode”Video size mode
"video" | "max" | "min"
sizeMax?
Section titled “sizeMax?”number
Maximum video size
Returns
Section titled “Returns”Snapshoter
Properties
Section titled “Properties”mirror
Section titled “mirror”
protectedmirror:boolean=false
Mirror captured images
renderer
Section titled “renderer”
protectedrenderer:CanvasRenderer
Renderer to take snapshot of
sizeMax?
Section titled “sizeMax?”
protectedoptionalsizeMax:number
Maximum video size
sizeMode
Section titled “sizeMode”
protectedsizeMode:"video"|"max"|"min"="video"
Video size mode
Methods
Section titled “Methods”snapshot()
Section titled “snapshot()”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.
Returns
Section titled “Returns”Promise<undefined | ImageData>
Promise resolved to the merged captured image
snapshotLayers()
Section titled “snapshotLayers()”snapshotLayers():
Promise<(undefined|ImageData)[]>
Take snapshot of the renderer
Enqueues capture after the next renderer update. All canvas layers are returned as separate images.
Returns
Section titled “Returns”Promise<(undefined | ImageData)[]>
Promise resolved to the array of captured images