screenshot

The screenshot object allows you to capture a screenshot of the composite video and graphics layers.

screenshot IDL

interface Screenshot { void syncCapture(ScreenshotParams params); Promise<void> asyncCapture(ScreenshotParams params); }; interface ScreenshotParams { [optional] attribute String destinationFileName; [optional] attribute String fileName; [optional, Default=JPEG] attribute String fileType; [optional, Default=""] attribute String description; [optional, Default=640] attribute int width; [optional, Default=480] attribute int height; [optional, Default=50] attribute int quality; [optional, Default=0] attribute int rotation; };

Object Creation

To create a screenshot object, first load the brightsign/screenshot module using the require() method. Then create an instance of the screenshot class.

var ScreenshotClass = require("@brightsign/screenshot"); var screenshot = new ScreenshotClass();

Screenshot

Use this interface to take screenshots.

syncCapture()
void syncCapture(ScreenshotParams params) 

Takes a screenshot at nearly the exact moment that it is called. Because this method might interrupt on-screen operations, it is more appropriate for debugging applications.

asyncCapture()

Takes a screenshot without interrupting other operations. This method is appropriate for production environments–where the timing of the capture is less important than seamless operation.

ScreenshotParams

This interface contains screenshot settings.

  • destinationFileName string: The native path and filename that will be saved.

  • fileName string: The name and path of the image file that will be saved (e.g. "SD:/myscreenshots/screen.jpg"). If the specified directory does not exist, the screenshot will fail. This is deprecated in favor of destinationFileName, but is still supported. 

  • fileType string: The file type of the image ("JPEG" or "BMP"). The default file type is "JPEG". Note that the file extension (".jpg" or ".bmp") is not appended to the filename by default and, if needed, should be included in the fileName string.

  • description string: An optional description.

  • width int: The width of the image file. The default value is 640.

  • height int: The height of the image file. The default value is 480.

  • quality int: The image quality of the screenshot (between 0 and 100). The default value is 50.

  • rotation int: The rotation of the screenshot image (in degrees). The default value is 0. Accepted values are 0, 90, 180, and 270.

Example

This script takes a screenshot asynchronously every five minutes, saving it to the root of the SD card. Note that the previous image is erased with each new screenshot.