Page tree
Skip to end of metadata
Go to start of metadata

ON THIS PAGE

The videomodeconfiguration object allows you to configure the video resolution and retrieve video output settings. 

videomodeconfiguration IDL
[
    GarbageCollected
] interface VideoModeConfiguration {
    Promise <ModeList> getAvailableModes();
    Promise <DOMString> getBestMode(DOMString connector);
    Promise <Mode> getActiveMode();
    Promise <Mode> getConfiguredMode();
    Promise <SetModeResult> setMode(Mode);
};

interface Mode {
    attribute DOMString modeName;
    attribute DOMString colorSpace;
    attribute DOMString colorDepth;
    attribute int frequency;
    attribute bool dropFrame;
    attribute unsigned width;
    attribute unsigned height;
    attribute unsigned graphicsPlaneHeight;
    attribute unsigned graphicsPlaneWidth;
    attribute bool preferred;
    attribute bool interlaced;
    attribute unsigned overscan;

};

interface SetModeResult {
    attribute bool restartRequired;
};

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 <DOMString> getBestMode(DOMString connector) 

Returns the largest supported video mode, 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 (or if no display is connected), this method returns a blank string.

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 an error.

setMode()
Promise <SetModeResult> setMode(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. 

Mode

This interface contains the settings of a video-mode configuration.

  • [DOMString] modeName: A description of the video mode (a full list of modes can be found here). The video mode can also be set to "auto".
  • [DOMString] colorSpace: The color space of the video signal ("8bit", "10bit", or "12bit")
  • [DOMString] colorDepth: The color depth of the video signal ("rgb", "yuv420", or "yuv422")
  • [int] frequency: The frame rate of the video output
  • [bool] dropFrame: A flag indicating whether the video timecode utilizes drop frames 
  • [unsigned] width: The width of the video output
  • [unsigned] height: The height of the video output
  • [unsigned] graphicsPlaneHeight: The width of the graphics plane 
  • [unsigned] graphicsPlaneWidth: The height of the graphics plane

    Note

    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.

  • [bool] preferred: A flag indicating 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" 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. Note that preferred mode ignores video profile settings (i.e. color space and bit depth).
  • [bool] interlaced: A flag indicating whether the video output is interlaced
  • [bool] overscan: A flag indicating whether the video output is using an overscan setting or not

SetModeResult

This interface is returned by the setMode() method.

  • [bool] restartRequired: A flag indicating whether or not a reboot is required for the change in video settings to take effect.

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));
        });
  • No labels