Object Creation
To create vidoemodeconfiguration object, first load the brightsign/videomodeconfiguration
module using the require()
method. Then create an instance of the videomodeconfiguration class.
Code Block |
---|
|
var VideoModeConfigurationClass = require("@brightsign/videomodeconfiguration");
var videoConfig = new VideoModeConfigurationClass(); |
VideoModeConfiguration
Use this interface to retrieve and modify the video-mode settings.
getAvailableModes()
Code Block |
---|
|
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()
Code Block |
---|
|
Promise<Mode> getBestMode(String 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, this method returns a blank string. If no display is connected, this method returns "Cannot read edid information".
getActiveMode()
Code Block |
---|
|
Promise<Mode> getActiveMode() |
Returns a Mode
interface containing information about the current active video mode.
Code Block |
---|
|
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()
Code Block |
---|
|
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()
Code Block |
---|
|
Promise<SetModeResult> setCustomModeline(String modeline) |
Sets the custom videomode with the supplied modeline (see Applying a Custom Resolution). The custom videomode can then be selected using setMode.
getScreenModes()
Code Block |
---|
|
Promise<ScreenConfigList> getScreenModes() |
Returns an array which describes each available output on the platform your player hardware and how they those outputs are configured. The . This method has been implemented as of BOS 9.0.15.
The ScreenConfig interface contains the returned settings from getScreenModes():
[String] outputName
: HDMI-1, 2, 3, or 4 [String] videoMode
: The videomode can be either:- A known BrightSign format videomode (for example, 1920x1080x60p)
- A full modeline as described on this page
- 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.
[int] screenX
: 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.[int] screenY
: 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.[String] transform
: 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. [bool] enabled
: Whether the screen is enabled for output
setScreenModes()
Code Block |
---|
|
Promise<SetModeResult> setScreenModes(ScreenConfigList configs) |
Takes the same format as argument that g
etScreenModes()
returns. This method has been implemented as of BOS 9.0.15.
Mode
This interface contains the settings of a video-mode configuration.
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.
ScreenConfig
[String]
outputName
[String]
videoMode
[int]
screenX
[int]
screenY
[String] transform
[bool] enabled
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.
Code Block |
---|
|
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));
}); |