sos
The sos
API groups together all functionality the @signageos/front-applet offers. This is a basic object that provides you with access to
all the applet functionality, such as device information, display control, video playback, and more.
All calls to the sos object need to happen after sos.onReady()
is resolved. After the sOS object is ready, there are global properties available, which can be used for applet customization and device identification.
// Simple example of using the sos API to play a video.
import sos from '@signageos/front-applet';
sos.onReady().then(async function () {
startYourApplet(); // Example method to run
// Any other code
}
Properties
appletVersion
The appletVersion
is the version of the current applet.
readonly appletVersion: string;
authHash
Learn more about using this API here
The authHash
property is an alternative device identifier, which is designed for secure pairing and locating devices through
the REST API.
- The
authHash
is commonly used as a link between the Applet deployed on the device and the device in device management. - The
authHash
is unique and can be revoked upon request. - The
authHash
can be used as a universal identifier for your Applet application.
readonly authHash: string;
config
The config
property is a Key-value dictionary of the applet configuration. It is assigned on the device with timing via Box or SDK/Rest API.
readonly config: Record<string, number | string | boolean>;
Methods
onReady()
The onReady()
method accepts an optional listener which is called after the sos API are loaded and ready. It also returns a promise
which is resolved at the same time as the listener.
onReady(listener?: () => void): Promise<void>;
Params
Name | Type | Description |
---|---|---|
listener (optional) | () => void | Optional listener which is called when the sos API is ready. |
Return value
Promise which is resolved when the sos API is ready.
Example
sos.onReady().then(async function () {
console.log(await sos.app.getType());
});
sos.onReady(async function () {
console.log(await sos.app.getType());
});
refresh()
The refresh()
method initializes the refresh of the applet. Similar to window.location.reload(), but the applet is not downloaded again.
refresh(): Promise<void>;
Return value
Promise that is resolved when the refresh is completed.
Example
await sos.refresh();
restore()
The restore()
method clears all previously played videos, streams, clear display view. The typical case of usage for digital signage
is playing a loop with some specified duration. This method should be called always when the loop is changed. It will clear all
previously played videos, streams, clear display views, and notify for garbage collection.
It stops all video playback and clears out the memory. The following function should be triggered only in a case the whole playback needs to be restarted as it's completely switching the playback 'loop/playlist'.
restore(): void;
Example
sos.onReady(async function () {
// Some function which is called when the applet is ready
sos.restore();
});