/**
* STB object declaration and documentation.
* JSDoc specification ({@link http://usejsdoc.org/}).
* An introduction to JSDoc ({@link http://www.2ality.com/2011/08/jsdoc-intro.html}).
*
* @fileOverview Callback functions to receive messages from STB application.
*/
'use strict';
/* jshint unused:false */
//noinspection JSUnusedGlobalSymbols
/**
* Main object stbEvent methods declaration.
*
* Event model in JavaScript assumes the possibility for API user to receive the events indicating some changes of the player playback state.
*
* After the initialization of the player (see appendix 1) call initEvents() function.
*
* The code of the last event is also stored in the stbEvent.event.
*
* @namespace
*/
var stbEvent = {
/**
* Receive a message from a window.
*
* @param {number} windowId
* @param {string} message
* @param {string} data
*/
onMessage:
function ( windowId, message, data ) {},
/**
* Receive a broadcast message from a window.
*
* @param {number} windowId
* @param {string} message
* @param {string} data
*/
onBroadcastMessage:
function ( windowId, message, data ) {},
/**
* The function to be called when getting the player event.
*
* It is used for processing the events in the portal with the event code as the parameter.
*
* @param {number} event type of event
* @param {string} info associated data in **JSON** format
*/
onEvent:
function ( event, info ) {},
/**
* The code of the last event.
*
* The following events are defined:
*
* Value | Description
* ------------|-------------
* 1 | The player reached the end of the media content or detected a discontinuity of the stream.
* 2 | Information on audio and video tracks of the media content is received. It's now possible to call gSTB.GetAudioPIDs etc.
* 4 | Video and/or audio playback has begun.
* 5 | Error when opening the content: content not found on the server or connection with the server was rejected.
* 6 | Detected DualMono AC-3 sound.
* 7 | The decoder has received info about the content and started to play. It's now possible to call gSTB.GetVideoInfo.
* 8 | Error occurred while loading external subtitles.
* 9 | Found new teletext subtitles in stream.
* 32 (0x20) | HDMI device has been connected.
* 33 (0x21) | HDMI device has been disconnected.
* 34 (0x22) | Recording task has been finished successfully. See Appendix 13. JavaScript API for PVR subsystem.
* 35 (0x23) | Recording task has been finished with error. See Appendix 13. JavaScript API for PVR subsystem.
* 40 (0x28) | Scanning DVB Channel in progress.
* 41 (0x29) | Scanning DVB Channel found.
* 42 (0x2A) | DVB Channel EPG update.
* 43 (0x2B) | DVB antenna power off.
* 129 (0x81) | When playing RTP-stream the numbering of RTP-packets was broken.
*
* @type {number}
*/
event: 0,
/**
* USB device mount/unmount.
*
* @param {number} state 0 - mount off, 1 - mount on
*/
onMount:
function ( state ) {},
/**
* Callback on current web document loading.
*
* Triggers every time the document loading progress changes.
*
* @param {number} progress loading stage value [0..100]
*/
onWebBrowserProgress:
function ( progress ) {},
/**
* Callback on browser web window activation.
*/
onWindowActivated:
function () {},
/**
* Callback on internet browser link clicked to ask user what to do with link: play or download.
*
* It is also used to start playing a downloaded item.
*/
onMediaAvailable:
function () {},
/**
* @deprecated
*/
onScreenSaverOverride:
function () {},
/**
* Callback on screensaver activation/deactivation.
*
* @param {boolean} mode possible values:
*
* Value | Description
* -------|-------------
* true | activation
* false | deactivation
*/
onScreenSaverActivation:
function ( mode ) {},
/**
* Callback fired on lost/restore local network connection.
*
* @param {boolean} status new network state
*/
onNetworkStateChange:
function ( status ) {},
/**
* Callback fired on lost/restore internet connection.
*
* @param {boolean} status new network state
*/
onInternetStateChange:
function ( status ) {},
/**
* @todo add description
*/
onLanguageChange:
function () {}
};