Render a Preview
You might write a controller that needs to show what a title will look like with certain variable settings before going live with it.
The “snapshot” command does just that. With it, you can set variables and request a preview rendering.
This example shows how to use the snapshot command to preview:
scheduler.scheduleCommand(
'getSnapshot',
{ input: inputName, encode: 1, scaleToFit: 1, width: 800, height: 300, sync: 1 },
settings.variables,
(resultString) => {
console.log(resultString);
}
);
encode
tells snapshot to return the png image as a byte-encoded string.
width
and height
set the size of the returned image.
scaleToFit
tells it to scale the image so it best fits the width and height, while maintaining the correct aspect ratio.
sync
tells snapshot to perform the work synchronously and return the data in the callback, otherwise, the data will come in a notification message.
And then, once you like what you see, safely update the live title using the scheduleAction
command:
scheduler.scheduleAction('update', inputName, '', settings.variables);

Last updated