Skip to main content
Version: 8.0.3

screen

The sos.management.screen API groups together methods for controlling the screen of the device. It allows to manipulate the screen resolution or orientation, set brightness, retrieve the current brightness of the display and manipulate the power mode.

warning

This method only turns on/off the display/backlight. It will not set any power-saving mode. We also strongly recommend to reboot any device once a day.

info

There is a specific behavior based on the device type you operate: On SoC displays (e.g. Samsung Tizen, LG webOS, Android-based SoC displays from Sony, Vestel Philips,...)

  • powerOn() and powerOff() are turning the display backlight and the panel off

On external media players (e.g. BrightSign, Windows PC, Android players, Raspberry Pi)

  • powerOn() and powerOff() are turning off the video output (typically HDMI-out); the connected display backlight is not managed by this functionality and needs to be controlled via RS232 or another way.

Methods

getBrightness()

The getBrightness() method returns information about the currently set brightness values.

getBrightness(): Promise<IBrightness>;

getOrientation()

The getOrientation() method returns the current orientation of the screen.

getOrientation(): Promise<IOrientation>;

isPoweredOn()

The isPoweredOn() method returns whether the screen is on.

isPoweredOn(): Promise<boolean>;

powerOff()

The powerOff() method turn the screen off.

warning

On Android devices, powerOff() also shuts down the webview and the Applet. It's default Android behavior that cannot be changed. Once the Applet is off, you cannot call powerOn() to resume the playback.

To manage the display On/Off state, use REST API Power Actions instead.

powerOff(): Promise<void>;

powerOn()

The powerOn() method turns the screen on.

powerOn(): Promise<void>;

resize()

The resize() method changes resolution and orientation of the display.

info

For Tizen, you have to provide baseUrl which points to the Core App for Tizen which will be downloaded to the device Read more how to upload your Core Apps here..

resize(baseUrl: string, orientation: string, resolution: string, currentVersion: string, videoOrientation?: string): Promise<void>;

Params

NameTypeDescription
baseUrlstringSSSP & Tizen devices requires to install a orientation-specific Core App if you want to switch orientation to portrait or landscape.
orientationstringScreen orientation
resolutionstringWhere it applies (mainly SSSP 2/3)
currentVersionstringCore App version
videoOrientation (optional)stringIf the video has different orientation than the HTML5 content

Example

// for Tizen
await sos.management.screen.resize(
"https://cdn.your-cms.com/tizen/1.0.4",
"PORTRAIT",
"FULL_READY",
"1.0.4"
);

// for all other supported device
await sos.management.screen.resize(
"",
"PORTRAIT",
"HD_READY",
""
);

setBrightness()

The setBrightness() method sets the brightness of the screen. It supports 2 different brightness values for 2 time points in the day.

setBrightness(timeFrom1: string, brightness1: number, timeFrom2: string, brightness2: number): Promise<void>;

Params

NameTypeDescription
timeFrom1stringTime in the XX:XX format
brightness1numberBrightness value between 0 and 100
timeFrom2stringTime in the XX:XX format
brightness2numberBrightness value between 0 and 100

Example

await sos.management.screen.setBrightness(
'00:00',
'10',
'17:00',
'30'
);

takeAndUploadScreenshot()

The takeAndUploadScreenshot() method takes a screenshot and uploads it to a specified url. This can be either a signageOS upload url (https://upload.signageos.io) or a dedicated server url for uploading screenshots. Format in which the screenshot is uploaded may be different for every platform.

To implement a custom screenshot upload server, it needs to implement these endpoints:

  • POST /upload/file?prefix=screenshot/ - Endpoint for receiving screenshot using form data, with the image set to the file field.
  • POST /upload/raw?prefix=screenshot/ - Endpoint for receiving screenshots as a raw data.
  • POST /upload/image-data-uri?prefix=screenshot/ - Endpoint for receiving screenshots encoded as a data url.

signageOS provides standalone server which is implements all of those methods. It is provided to all of our partners through the support ticketing system.

takeAndUploadScreenshot(uploadBaseUrl: string): Promise<string>;