Skip to main content

Getting started

info

This section primarily focuses on developers with some previous knowledge of web development. Others can use the Web Editor for Applet in Box for creating applets with minimal previous knowledge.

Applet JS SDK provides device's native features and functionalities with unified API for all supported platforms. This SDK is only usable inside of signageOS applets and allows you to create lightweight applets and deploy them on any device.

import sos from '@signageos/front-applet';

sos.onReady(async () => {
await sos.management.audio.setVolume(75);
});
tip

Quick tip: install autocomplete for CLI commands with sos autocomplete install. Read more.

Automated installation

warning

Before installation you need to have sos CLI installed. More in CLI Setup

To create a new applet project run:

sos applet generate

This command will create package.json with useful scripts for the applet development.

  • start - starts a local dev server with a emulator.
  • build - builds the applet to the dist folder.
  • upload - uploads the applet built with build to the Cloud Control.
  • connect - sets up the applet for debugging on a real device.

Local development

Running the start command will launch a dev server and an emulator, which will watch source files and automatically reloads the applet if anything changes.

npm run start

By default the emulator with the applet is on http://localhost:8090

Using the sos SDK

To make the code simpler and portable between different platforms, all applet may use the sos SDK which exposes unified API for native functionality. All calls to the sos needs to happen after sos.onReady() is resolved.

import sos from '@signageos/front-applet';

sos.onReady().then(async () => {
// Save the
const { filePath } = await sos.offline.cache.loadOrSaveFile(
'video-1.mp4',
'https://static.signageos.io/assets/video-test-1_e07fc21a7a72e3d33478243bd75d7743.mp4',
);

await sos.video.play(filePath, 0, 0, 1280, 720);
});

Deploy to a device

You will need:

First, the applet needs to be built and uploaded to the Cloud Control. To make sure that the applet will be able to run on older device, you can use npm run escheck.

npm run build
npm run upload

This uploads the applet into the default organization and makes it available for deployment to the device.

Follow How to assign Applet to the device via Timings to deploy the applet with CloudControl.