Skip to main content
Version: 6.3.0

Video Playback

We know how crucial video is for digital signage. So we made it easy. There are several methods you can use for video manipulation.

All methods/events

Methods/EventsDescriptionSupported since
play()Start video playing1.0.3
prepare()Prepare next video1.0.3
pause()Pause video1.0.3
stop()Completely stop video1.0.3
resume()Continue in playing1.0.3
onceEnded()Wait until video ends1.0.29
onEnded()Event called when video ends1.0.3
onError()Event called when video emits error1.0.3
warning

First 5 parameters (uri, x, y, width, height) are unique identifiers for playing the video using play, stop, resume and pause methods.

info

If you want to play video in full screen mode, use x = y = 0 and width = document.documentElement.clientWidth and height = document.documentElement.clientHeight as setup parameters.

How it works

Gapless video playback lifecycle

play()

Play method calls the internal player and starts the video in correct position.

Parameters

ParamTypeRequiredDescription
uriString
Yes
Address to remote (online) or local video file
xNumber
Yes
x-position for video on screen
yNumber
Yes
y-position for video on screen
widthNumber
Yes
Video width on screen
heightNumber
Yes
Video height on screen

Javascript

await sos.video.play(uri, x, y, width, height);

prepare()

Prepare method calls the internal player and preload the video into memory.

info

Using prepare() is mandatory for gapless playback

warning

4k parameter is no longer needed since Front-display v7.5.0, Tizen Core App v2.1.0.
volume is supported only on the RaspberryPi.

Parameters

ParamTypeRequiredDescription
uriString
Yes
Address to remote /online/ or local video file
xNumber
Yes
x-position for video on screen
yNumber
Yes
y-position for video on screen
widthNumber
Yes
Video width on screen
heightNumber
Yes
Video height on screen
optionsObject
No
Additional video properties

Options properties

PropertyTypeRequiredDescription
4kBoolean
No
Support for 4k video
^^^^^^Deprecated since Tizen Core App v2.1.0
backgroundBoolean
No
Bring video behind the applet html (similar to z-index: -1)
volumeNumber
No
Adjust volume of playing video itself (doesn't adjust display speaker volume)
^^^^^^Supported only on RaspberryPi

Javascript

// playing video
await sos.video.prepare(uri, x, y, width, height);
// or advanced usage
await sos.video.prepare(uri, x, y, width, height, {
'4k': true,
background: true,
volume: 60,
});

stop(), pause() and resume()

All these methods call the internal player. All variables are mandatory in order to ensure video identification.

Parameters

ParamTypeRequiredDescription
uriString
Yes
Address to remote (online) or local video file
xNumber
Yes
x-position for video on screen
yNumber
Yes
y-position for video on screen
widthNumber
Yes
Video width on screen
heightNumber
Yes
Video height on screen

Javascript

// stop video
await sos.video.stop(uri, x, y, width, height);

// pause
await sos.video.pause(uri, x, y, width, height);

// resume
await sos.video.resume(uri, x, y, width, height);

Event onceEnded

Wait until one specific video is ended.

Parameters

ParamTypeRequiredDescription
uriString
Yes
Address to remote (online) or local video file
xNumber
Yes
x-position for video on screen
yNumber
Yes
y-position for video on screen
widthNumber
Yes
Video width on screen
heightNumber
Yes
Video height on screen

Javascript

// wai on end of video
await sos.video.onceEnded(uri, x, y, width, height);

Events onEnded, onError

All events about played videos can be binded using above mentioned methods. It will emit all events of all playing videos. Video source of emited event can be identified by srcArguments object available in event.

Listener method added as argument accepts event object. It contains these properties:

PropertyDescription
typeType of event which can be ended or error string
srcArgumentsArguments which was passed to play method.
Contains uri, x, y, width & height.

Javascript

// detect video ended
await sos.video.onEnded((event) => { console.log(event); });

// detect video error
await sos.video.onError((event) => { console.log(event); });

Usage with Typescript

You can also use all these methods with signageOS TypeScript.

play(
uri: string,
x: number,
y: number,
width: number,
height: number
): Promise<void>;
prepare(
uri: string,
x: number,
y: number,
width: number,
height: number,
options?: {
'4k'?: boolean;
background?: boolean;
volume?: number;
}
): Promise<void>;
stop(
uri: string,
x: number,
y: number,
width: number,
height: number
): Promise<void>;
pause(
uri: string,
x: number,
y: number,
width: number,
height: number
): Promise<void>;
resume(
uri: string,
x: number,
y: number,
width: number,
height: number
): Promise<void>;

Errors

Although we are doing our best, following errors may occur when working with the video stream.

CodeTypeMessage
41501AppletVideoErrorThis video was not played yet. The arguments: arguments
51501InternalVideoErrorCouldn't play the video.
51502InternalVideoErrorCouldn't prepare the video.
51503InternalVideoErrorCouldn't stop the video.
51504InternalVideoErrorCouldn't pause the video.
51505InternalVideoErrorCouldn't resume the video.