videomodeconfiguration
12 min
the videomodeconfiguration object allows you to configure the video resolution and retrieve video output settings videomodeconfiguration idl interface videomodeconfiguration { promise\<modelist> getavailablemodes(); promise\<mode> getbestmode(string connector); promise\<mode> getactivemode(); promise\<mode> getconfiguredmode(); promise\<setmoderesult> setmode(mode mode); 	promise\<setmoderesult> setcustommodeline(string modeline) 	promise\<screenconfiglist> getscreenmodes(); promise\<setmoderesult> setscreenmodes(screenconfiglist configs); }; interface mode { attribute string modename; attribute string colorspace; attribute string colordepth; attribute int frequency; attribute bool dropframe; attribute int width; attribute int height; attribute int graphicsplaneheight; attribute int graphicsplanewidth; attribute bool preferred; attribute bool interlaced; attribute int overscan; }; interface setmoderesult { attribute bool restartrequired; }; interface screenconfig { attribute string outputname; attribute string videomode; attribute int screenx; attribute int screeny; attribute string transform; attribute bool enabled; }; object creation to create vidoemodeconfiguration object, first load the brightsign/videomodeconfiguration module using the require() method then create an instance of the videomodeconfiguration class var videomodeconfigurationclass = require("@brightsign/videomodeconfiguration"); var videoconfig = new videomodeconfigurationclass(); videomodeconfiguration use this interface to retrieve and modify the video mode settings getavailablemodes() promise\<modelist> getavailablemodes() returns a list containing all video modes supported by the player each supported video mode is listed as a mode instance getbestmode() promise\<mode> getbestmode(string connector) returns the largest supported video mode docid\ qpml112mbhek7lbdguxnv , as reported by the display via edid the video connector can be specified as "hdmi" or "vga" (these values are case sensitive) if the display does not return a resolution value over edid, this method returns a blank string if no display is connected, this method returns "cannot read edid information" getactivemode() promise\<mode> getactivemode() returns a mode interface containing information about the current active video mode getconfiguredmode() promise\<mode> getconfiguredmode() returns a mode interface containing information about the video mode that has been configured with the setmode() method if the video mode has not been configured with setmode() (or if it has been set to "auto"), this method will return null setmode() promise\<setmoderesult> setmode(mode mode) sets the video output mode using a passed mode interface this method returns a promise containing a setmoderesult interface that indicates whether a reboot is required for the specified video settings to take effect setcustommodeline() promise\<setmoderesult> setcustommodeline(string modeline) sets the custom videomode with the supplied modeline (see apply a custom resolution docid 58vplqm4sgh vgqvs4frs ) the custom videomode can then be selected using setmode getscreenmodes() promise\<screenconfiglist> getscreenmodes() returns an array which describes each available output on your player hardware and how those outputs are configured this method has been implemented as of bos 9 0 15 the screenconfig interface contains the returned settings from getscreenmodes() outputname \<font color="#6554c0">string\</font> hdmi 1, 2, 3, or 4 videomode \<font color="#6554c0">string\</font> the videomode can be either a known brightsign format videomode (for example, 1920x1080x60p) a full modeline as described on this page docid 58vplqm4sgh vgqvs4frs auto which differs slightly from previous platforms auto isn’t recommended when using multiple outputs because the canvas positions are fixed and so if a screen uses an unexpected resolution, it won’t be positioned correctly in the canvas screenx \<font color="#6554c0">int\</font> the position of the screen on the canvas the origin (0,0) is the top left corner, and each screen can be positioned relative to it this allows gaps to be left on the canvas between screens for bezel compensation screeny \<font color="#6554c0">int\</font> the position of the screen on the canvas the origin (0,0) is the top left corner, and each screen can be positioned relative to it this allows gaps to be left on the canvas between screens for bezel compensation transform \<font color="#6554c0">string \</font> one of normal, 90, 180 or 270 rotations each screen can be rotated independently and when a screen is rotated, all content including video will be rotated enabled \<font color="#6554c0">bool\</font> whether the screen is enabled for output setscreenmodes() promise\<setmoderesult> setscreenmodes(screenconfiglist configs) takes the same format as argument that getscreenmodes() returns by default a single screen is enabled the player uses full resolution graphics if any of the videomodes configured using setscreenmodes use the \ fullres modifier see this page docid\ qq734nqz0hcwni0unsdmp to understand how the x/y display coordinates work with output resolution this method has been implemented as of bos 9 0 and later mode this interface contains the settings of a video mode configuration in 4k modes, the graphics plane may be smaller than the video plane and output in these cases, the graphics plane is upscaled to match the video plane/output modename \<font color="#6554c0">string\</font> a description of the video mode docid 58vplqm4sgh vgqvs4frs (as well as any additional video mode parameters docid\ qq734nqz0hcwni0unsdmp ) the video mode can also be set to "auto" docid\ qq734nqz0hcwni0unsdmp , “gfxmemlarge”, or "custom" which will use the mode configured using setcustommodeline colorspace \<font color="#6554c0">string\</font> the color space of the video signal ("rgb", "yuv420", or "yuv422") colordepth \<font color="#6554c0">string\</font> the color depth of the video signal ("8bit", "10bit", or "12bit") frequency \<font color="#6554c0">int\</font> the frame rate of the video output dropframe \<font color="#6554c0">bool\</font> a flag indicating whether the video timecode utilizes drop frames width \<font color="#6554c0">int\</font> the width of the video output height \<font color="#6554c0">int\</font> the height of the video output graphicsplaneheight \<font color="#6554c0">int\</font> the width of the graphics plane graphicsplanewidth \<font color="#6554c0">int\</font> the height of the graphics plane preferred \<font color="#6554c0">bool\</font> whether the video mode is the preferred mode, which instructs the player to only use the video mode if the display edid indicates that it is supported otherwise, the output will default to "auto" video docid\ qq734nqz0hcwni0unsdmp mode if no edid is detected at bootup, the player will output the preferred video mode if an hdmi ® hotplug event occurs afterward, then the player will perform the preferred video mode check again preferred mode ignores video profile settings (i e color space and bit depth) interlaced \<font color="#6554c0">bool\</font> whether the video output is interlaced overscan \<font color="#6554c0">int \</font> whether the video output is using an overscan setting or not setmoderesult this interface is returned by the setmode() method restartrequired \<font color="#6554c0">bool\</font> a flag indicating whether or not a reboot is required for the change in video settings to take effect screenconfig outputname \<font color="#6554c0">string\</font> videomode \<font color="#6554c0">string\</font> screenx \<font color="#6554c0">int\</font> screeny \<font color="#6554c0">int\</font> transform \<font color="#6554c0">string\</font> enabled \<font color="#6554c0">bool\</font> example this script retrieves the largest supported video mode (as reported by the display edid over hdmi) and sets the video output to this mode it then reboots the player if required var videomodeconfigurationclass = require("@brightsign/videomodeconfiguration"); var videoconfig = new videomodeconfigurationclass(); var systemclass = require("@brightsign/system"); var system = new systemclass(); var bestres = ""; videoconfig getbestmode("hdmi") then( function(data) { bestres = data; }) catch( function(data) { console log(json stringify(data)); }); var configdata = {}; configdata modename = bestres; videoconfig setmode(configdata) then( function(data) { if (data restartrequired === true) { system reboot(); } else { console log("reboot not required ") } }) catch( function(data) { console log(json stringify(data)); });