Player APIs (BrightScript & Ja...
JavaScript APIs
screenshot
6min
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() promise\<void> asynccapture(screenshotparams params) 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 string the native path and filename that will be saved filename string 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 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 string optional optional an optional description width int int the width of the image file the default value is 640 height int int the height of the image file the default value is 480 quality int int the image quality of the screenshot (between 0 and 100) the default value is 50 rotation int 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 var screenshotclass = require("@brightsign/screenshot"); var screenshot = new screenshotclass(); function takeasyncscreenshot(args) { screenshot asynccapture(args) then() catch(); }; screenshotparams = {}; screenshotparams filename = "sd /screen jpg"; screenshotparams quality = 75; setinterval(takeasyncscreenshot(screenshotparams), 10000);