Main object gSTB methods declaration.
Methods
-
ClearStatistics
<static> ClearStatistics () -
Clear player statistics.
See gSTB.GetStatistics.
-
CloseWebWindow
<static> CloseWebWindow () -
Closes dedicated web window.
- Since:
- 0.2.16
-
Continue
<static> Continue () -
Continue playing (after gSTB.Pause) or begin anew (after gSTB.Stop).
-
Debug
<static> Debug ( text ) -
Show the contents of the string text in the stream of standard output in the format:
DEBUG: [time] text
.Parameters:Name Type Description text
string
this string is shown in the stream of standard output
-
DeinitPlayer
<static> DeinitPlayer () -
De-initialize the player.
-
DeleteAllCookies
<static> DeleteAllCookies () -
Delete all cookie saved by the browser.
-
EnableAppButton
<static> EnableAppButton ( mode ) -
Assign a new status for "
App
" button handler.Parameters:Name Type Description mode
boolean
possible values:
Value Description true application will take control under the " App
" buttonfalse the " App
" button will be handled as a regular button -
EnableJavaScriptInterrupt
<static> EnableJavaScriptInterrupt ( mode ) -
Enable/disable Javascript interrupt dialog, when Javascript code does not respond for some long time.
Use this function only for debugging purpose.
Parameters:Name Type Description mode
boolean
possible values:
Value Description true enable interrupt false disable interrupt -
EnableMulticastProxy
<static> EnableMulticastProxy ( mode ) -
Enable multicast proxy.
If multicast proxy URL is set and multicast proxy enabled then any multicast
rtp://
orudp://
stream will be played back via multicast proxy e.i. instead ofrtp://239.1.1.1:1234
player play the following stream:http://[proxy_addr]/rtp/239.1.1.1:1234
Parameters:Name Type Description mode
boolean
possible values:
Value Description true enable multicast proxy false disable multicast proxy -
EnableServiceButton
<static> EnableServiceButton ( mode ) -
Enable or disable automatic start of Service Menu by pressing "
SET
" ("service
" on old RC) button.If button "
SET
" ("service" on old RC) is already used by JavaScript code, there may be a conflict.To avoid this conflict JavaScript code should disable automatic start of Service Menu and call directly function gSTB.StartLocalCfg every time it is required.
Parameters:Name Type Description mode
boolean
possible values:
Value Description true enable automatic start false disable automatic start -
EnableSetCookieFrom
<static> EnableSetCookieFrom ( domain, mode ) -
Allow or forbid to set cookie from given domain.
By default any domain is allowed to set cookie.
Each call of this function adds domain (mode is false) or removes it (mode is true) from the list of domains that are not allowed to set cookie.
Parameters:Name Type Description domain
string
if mode is true then any attempt to set cookie from given domain will be ignored
mode
boolean
possible values:
Value Description true allow to set cookie from given domain false forbid to set cookie from given domain -
EnableSpatialNavigation
<static> EnableSpatialNavigation ( mode ) -
Enable or disable 2D navigation (arrow navigation) on web pages.
2D navigation is disabled by default, but could be enabled on previous web page, so it is recommended to disable 2D navigation if current page does not use it.
Parameters:Name Type Description mode
boolean
possible values:
Value Description true enable 2D navigation false disable 2D navigation -
EnableTvButton
<static> EnableTvButton ( mode ) -
Enable application defined "
TV
" button processing. When enabled "TV
" button events will be consumed by application and will not pass to the portal web window.Parameters:Name Type Description mode
boolean
possible values:
Value Description true enable false disable - Since:
- 0.2.16
-
EnableVKButton
<static> EnableVKButton ( mode ) -
Enable or disable automatic show/hide of virtual keyboard by pressing "
KB
" ("empty
" on old RC) button.If button "
KB
" ("empty" on old RC) is already used by JavaScript code, there may be a conflict.To avoid this conflict JavaScript code should disable automatic start of virtual keyboard and call directly functions gSTB.ShowVirtualKeyboard or gSTB.HideVirtualKeyboard every time it is required.
Parameters:Name Type Description mode
boolean
possible values:
Value Description true enable automatic show/hide false disable automatic show/hide -
ExecAction
<static> ExecAction ( action ) -
Perform the script
/home/default/action.sh
with the parameters set.Parameters:Name Type Description action
string
contains parameters for the script
Example
// calls shell command "/home/default/action.sh param 23 s" gSTB.ExecAction('param 23 s');
-
ExtProtocolCommand
<static> ExtProtocolCommand ( id, command, params ) → {string} -
Send command to player's external protocol plugin.
Parameters:Name Type Description id
string
external protocol identifier
command
string
command to execute
params
string
command arguments
Returns:Type Description string
result of command execution (plugin dependant)
-
ForceHDMItoDVI
<static> ForceHDMItoDVI ( mode ) -
Force HDMI output to DVI mode.
Parameters:Name Type Description mode
number
possible values:
Value Description 0 auto detect HDMI mode 1 force HDMI to DVI mode -
Get3DConversionMode
<static> Get3DConversionMode () → {number} -
Get current 3D conversion mode.
Returns:Type Description number
-
GetAlphaLevel
<static> GetAlphaLevel () → {number} -
Receive the video window alpha transparency level.
Returns:Type Description number
the current value of alpha transparency for the video window
-
GetAspect
<static> GetAspect () → {number} -
Return the current video content format.
See gSTB.SetAspect.
Returns:Type Description number
consists of 2 tetrads:
7 6 5 4 3 2 1 0 aspH aspL aspL - the aspect ratio:
Value Description 0 automatic 1 20:9 2 16:9 3 4:3 aspH - conversion of video format:
Value Description 0 as it is (video is stretched for the whole screen) 1 Letter box mode (video is proportionally enlarged to the size of the screen along the larger edge) 2 Pan&Scan mode (video is proportionally enlarged to the screen size along the lesser edge) 3 combined mode (intermediate between Letter Box Box and Pan&Scan) 4 enlarged mode 5 optimal mode -
GetAudioPID
<static> GetAudioPID () → {number} -
Receive the number (PID) of the current audio track.
The list of all audio tracks determined by the player can be received with gSTB.GetAudioPIDs.
Returns:Type Description number
current audio track number [0..0x1fff]
-
GetAudioPIDs
<static> GetAudioPIDs () → {string} -
Get the list of audio tracks in the stream with the description of the language.
This stream can be easily converted into a structure array by calling the function
eval
.This function must be called after the
event 2
occurs (see description of events).Returns:Type Description string
list of the audio tracks found in the following format:
[{pid:<PID1>, lang:[<lang1_1>, <lang2_1>]}, ... , {pid:<PIDn>, lang:[<lang1_n>, <lang2_n>]}]
where:
Value Description PIDn PID of audio track with the number n lang1_n, lang2_n first two descriptions of languages in audio track number n 3-symbol tags according to ISO 639 Example
// execution result // 2 audio streams in the stream: Russian having PID=114 and English having PID=115 '[{pid:114, lang:["rus", "ru"]}, {pid:115, lang:["eng", ""]}]'
-
GetAudioPIDsEx
<static> GetAudioPIDsEx () → {string} -
Get the list of audio tracks in the stream with the description of the language and audio codec type.
This stream can be easily converted into a structure array by calling the function
eval
. This function must be called after theevent 2
occurs (see description of events).Returns:Type Description string
list of the audio tracks found in the following format:
[{pid:<PID1>, lang:[<lang1_1>, <lang2_1>], type:<type_1>}, ... , {pid:<PIDn>, lang:[<lang1_n>, <lang2_n>], type:<type_n>}]
where:
Value Description PIDn PID of audio track with the number n lang1_n, lang2_n first two descriptions of languages in audio track number n 3-symbol tags according to ISO 639 type_n is audio codec type:
Value Description 0 Unknown 1 mp2a 2 mp3 3 AC3 4 AAC 5 PCM 6 OGG 7 DTS Example
// execution result // 2 audio streams in the stream: Russian AC3 having PID=114 and English mp3 having PID=115 '[{pid:114, lang:["rus", "ru"], type:3}, {pid:115, lang:["eng", ""], type:2}]'
-
GetBrightness
<static> GetBrightness () → {number} -
Receive current brightness of video output in SD.
Returns:Type Description number
brightness of video output in SD mode [1..254]
-
GetBufferLoad
<static> GetBufferLoad () → {number} -
Get the current buffer loading in percents.
It makes sense to call this function only with the following solutions: ffmpeg, ffrt, ffrt2, ffrt3, fm, file after getting
event 2
from List of the events used and before complete buffer filling or before gettingevent 4
from List of the events used.Returns:Type Description number
current buffer loading in percents [0..100]
-
GetContrast
<static> GetContrast () → {number} -
Receive current contrast of video output in SD mode.
Returns:Type Description number
contrast of video output in SD mode [-128..127]
-
GetDefaultUpdateUrl
<static> GetDefaultUpdateUrl () → {string} -
Get default update URL.
- Since:
- 0.2.16
Returns:Type Description string
URL that can be used in update procedure
Example
// execution result 'http://aurahd.infomir.com.ua/imageupdate'
-
GetDeviceActiveBank
<static> GetDeviceActiveBank () → {string} -
Get active bank of NAND.
Returns:Type Description string
the same as
/home/default/rdir.cgi GetCurrentBank
-
GetDeviceImageDesc
<static> GetDeviceImageDesc () → {string} -
Get image description.
Returns:Type Description string
info
Example
// execution result '0.2.18-250'
-
GetDeviceImageVersion
<static> GetDeviceImageVersion () → {string} -
Get image version.
Returns:Type Description string
info
Example
// execution result '218'
-
GetDeviceImageVersionCurrent
<static> GetDeviceImageVersionCurrent () → {string} -
Get current image version.
Returns:Type Description string
info
Example
// execution result '0.2.16-250 Tue Apr 9 18:10:19 EEST 2013'
-
GetDeviceMacAddress
<static> GetDeviceMacAddress () → {string} -
Get MAC address.
Returns:Type Description string
info
Example
// execution result '10:bf:48:3f:74:42'
-
GetDeviceModel
<static> GetDeviceModel () → {string} -
Get model of the device.
Returns:Type Description string
info
Example
// execution result 'MAG250'
-
GetDeviceModelExt
<static> GetDeviceModelExt () → {string} -
Get STB model name.
Returns:Type Description string
info
Example
// execution result 'AuraHD1'
-
GetDeviceSerialNumber
<static> GetDeviceSerialNumber () → {string} -
Get serial number.
Returns:Type Description string
info
Example
// execution result '052012B031491'
-
GetDeviceVendor
<static> GetDeviceVendor () → {string} -
Get vendor information.
Returns:Type Description string
info
Example
// execution result 'TeleTec'
-
GetDeviceVersionHardware
<static> GetDeviceVersionHardware () → {string} -
Get hardware information.
Returns:Type Description string
info
Example
// execution result '1.9-BD-00'
-
GetEnv
<static> GetEnv ( varList ) → {string} -
Read specified boot loader’s variables.
Parameters:Name Type Description varList
string
list of variables names to read in JSON format
signature:
{varList:Array.<string>}
Returns:Type Description string
list of variables names with values and error message in JSON format
signature:
{result:Object, errMsg:string, errCode:number}
Fields:
Name Description result holds result of operation (only pairs) and each pair name is equal to variable name, value of the pair representing value of variable in string notation errMsg empty string in case of success or non-localized string that representing error condition otherwise errCode 0 in case of success or -1 in case of general error Example
// parsed JSON data JSON.parse(gSTB.GetEnv('{"varList":["a", "b", "timezone_conf_int", "wifi_ssid", "tvsystem"]}')); // execution result { result: { a: "", b: "", timezone_conf_int: "plus_02_00_13", wifi_ssid: "default_ssid", tvsystem: "720p-60" }, errMsg: "", errCode: 0 }
-
GetExtProtocolList
<static> GetExtProtocolList () → {string} -
Get a list of loaded external protocol plugins.
Returns:Type Description string
list of loaded external protocol plugins in JSON format.
signature:
{name:string}[]
Example
// parsed JSON data JSON.parse(gSTB.GetExtProtocolList()); // execution result [ {name: "test"}, {name: "test2"} ]
-
GetHDMIConnectionState
<static> GetHDMIConnectionState () → {number} -
Get HDMI connection state.
Returns:Type Description number
possible values:
Value Description 0 HDMI disconnected from TV. 1 HDMI connected to TV, but not in active state e.i. standby mode, TV is off 2 HDMI connected to TV in active state. -
GetHLSInfo
<static> GetHLSInfo () → {string} -
Get information about bitrate variants of currently played HLS stream.
Returns:Type Description string
information about bitrate of HLS stream variants in JSON format
signature:
{currentVariant:number, variants:Array.<number>}
Fields:
Name Description currentVariant the number of currently active variant in variants array variants a list of bitrates for all variants and can be empty (available only for Apple HLS streams) Example
// parsed JSON data JSON.parse(gSTB.GetHLSInfo()); // execution result { currentVariant: 0, variants: [323613, 533981, 755232, 1384811, 2020273] }
-
GetInputLang
<static> GetInputLang () -
Get current input language.
-
GetLanLinkStatus
<static> GetLanLinkStatus () → {boolean} -
Get link status of LAN network interface (eth0).
Returns:Type Description boolean
possible values:
Value Description true link is active false no link connections -
GetLedIndicatorState
<static> GetLedIndicatorState () → {string} -
Return LED indicator mode and levels info.
- Since:
- 2.18
Returns:Type Description string
info in JSON format
signature:
{mode:number, levelBase:number, levelBlink:number}
Fields:
Name Description mode current mode levelBase base LED level levelBlink level for blinking -
GetMediaLen
<static> GetMediaLen () → {number} -
Get the duration of the current content.
Returns:Type Description number
total duration of the current content in seconds
-
GetMediaLenEx
<static> GetMediaLenEx () → {number} -
Get the duration of the current content in ms.
Returns:Type Description number
total duration of the current content in ms
-
GetMetadataInfo
<static> GetMetadataInfo () → {string} -
Get metadata information stored in current content. For example, it can be data from ID3 tag from mp3 file.
It makes sense to call this function after getting
event 2
from List of the events used.Returns:Type Description string
metadata from the current content
Example
// parsed JSON data JSON.parse(gSTB.GetMetadataInfo()); // execution result { album: "album_1", album_artist: "artist_1", artist: "artist_1", comment: "", composer: "", copyright: "", date: "2000", disc: "", encoder: "", encoded_by: "", filename: "", genre: "", language: "", performer: "", publisher: "publisher_1", title: "track_9", track: "9" }
-
GetMicVolume
<static> GetMicVolume () → {number} -
Receive the current microphone volume level.
Platform: MAG100
Returns:Type Description number
the current microphone volume level [0..100]
-
GetMute
<static> GetMute () → {number} -
Receive the muted state of audio output.
Returns:Type Description number
possible values:
Value Description 0 output is not muted 1 output is muted -
GetNetworkGateways
<static> GetNetworkGateways () → {string} -
Returns network gateways list.
- Since:
- 0.2.16
Returns:Type Description string
list of IP addresses separated by "\n"
-
GetNetworkNameServers
<static> GetNetworkNameServers () → {string} -
Returns name servers (remote DNS servers) list.
- Since:
- 0.2.16
Returns:Type Description string
list of DNS addresses separated by "\n"
-
GetNetworkWifiMac
<static> GetNetworkWifiMac () -
Returns MAC address for WiFi interface. May return "
" if there is no WiFi interface exist. -
GetPIG
<static> GetPIG () → {boolean} -
Receive the video window state.
Returns:Type Description boolean
the result specifies whether full screen mode is set for the video window:
Value Description true the content is displayed in a reduced window false the content is displayed in a full screen mode -
GetPosPercent
<static> GetPosPercent () → {number} -
Get the current position in percent.
Returns:Type Description number
the current position in percent of the whole duration of the content [0..100]
-
GetPosPercentEx
<static> GetPosPercentEx () → {number} -
Get the current position in hundredth fractions of percent.
Returns:Type Description number
the current position in percent of the whole duration of content [0..10000]
-
GetPosTime
<static> GetPosTime () → {number} -
Get the current position in time.
Returns:Type Description number
the current position in second from the beginning of content
-
GetPosTimeEx
<static> GetPosTimeEx () → {number} -
Get the current position in time in ms.
Returns:Type Description number
the current position in ms from the beginning of content
-
GetPppoeIp
<static> GetPppoeIp () → {string} -
Returns IP address for PPPoE interface.
- Since:
- 0.2.16
Returns:Type Description string
IP address
-
GetPppoeLinkStatus
<static> GetPppoeLinkStatus () → {boolean} -
Returns status for PPPoE interface.
- Since:
- 0.2.16
Returns:Type Description boolean
possible values:
Value Description true link is active false disconnected -
GetSaturation
<static> GetSaturation () → {number} -
Receive current saturation of video output in SD mode.
Returns:Type Description number
saturation of video output in SD mode [1..254]
-
GetSmbGroups
<static> GetSmbGroups () → {string} -
Fetch available Samba workgroups.
Returns:Type Description string
list of Samba groups in JSON format
signature:
{result:string[], errMsg:string, errCode:number}
Fields:
Name Description result holds result of operation errMsg empty string in case of success or non-localized string that representing error condition otherwise errCode 0 in case of success or -1 in case of general error Example
// parsed JSON data JSON.parse(gSTB.GetSmbGroups()); // execution result { result: ["WORKGROUP", "RESTGROUP"], errMsg: "", errCode: 0 }
-
GetSmbServers
<static> GetSmbServers ( group ) → {string} -
Fetch available servers for given work group.
Parameters:Name Type Description group
string
defines workgroup of interest in JSON format
signature:
{group:string}
Returns:Type Description string
list of servers in JSON format
signature:
{result:string[], errMsg:string, errCode:number}
Fields:
Name Description result holds result of operation errMsg empty string in case of success or non-localized string that representing error condition otherwise errCode 0 in case of success or -1 in case of general error Example
// parsed JSON data JSON.parse(gSTB.GetSmbServers('{"group":"WORKGROUP"}')); // execution result { result: ["ARCHIVE", "EDDY", "SANDBOX"], errMsg: "", errCode: 0 }
-
GetSmbShares
<static> GetSmbShares ( server ) → {string} -
Fetch available Samba shares for the given server.
Parameters:Name Type Description server
string
defines server of interest in JSON format
signature:
{server:string}
Returns:Type Description string
list of Samba network shares info in JSON format
signature:
{result:{shares:string[], serverIP:string}, errMsg:string, errCode:number}
Fields:
Name Description result holds result of operation result.shares an array of share names result.serverIP holds IP address of given server errMsg empty string in case of success or non-localized string that representing error condition otherwise errCode 0 in case of success or -1 in case of general error Example
// parsed JSON data JSON.parse(gSTB.GetSmbShares('{"server": "ALEX-PC"}')); // execution result { result: { shares: ["share", "photo"], serverIP: "192.168.100.1" }, errMsg: "", errCode: 0 }
-
GetSpeed
<static> GetSpeed () → {number} -
Receive the current speed of playing.
Returns:Type Description number
possible values:
Value Description 1 normal 2 2x 3 4x 4 8x 5 16x 6 1/2 7 1/4 8 12x -1 reverse -2 reverse 2x -3 reverse 4x -4 reverse 8x -5 reverse 16x -8 reverse 12x -
GetStandByStatus
<static> GetStandByStatus () → {boolean} -
Get the current working mode.
Returns:Type Description boolean
true - in standby mode
-
GetStatistics
<static> GetStatistics () → {string} -
Get player statistics.
See gSTB.ClearStatistics.
Returns:Type Description string
statistics data in JSON format
signature:
{CCErrorCnt:number, RTPErrorCnt:number, VideoDecodingErrorCnt:number}
Fields:
Name Description CCErrorCnt continuity counter error count RTPErrorCnt RTP error count VideoDecodingErrorCnt video decoding error count Example
// parsed JSON data JSON.parse(gSTB.GetStatistics()); // execution result { CCErrorCnt: 0, RTPErrorCnt: 0, VideoDecodingErrorCnt: 0 }
-
GetStorageInfo
<static> GetStorageInfo ( filter ) → {string} -
Get all mount point info.
Parameters:Name Type Description filter
string
optional filter for the operation
Returns:Type Description string
list of storage info in JSON format
signature:
{result:Object[], errMsg:string, errCode:number}
Fields:
Name Description result holds result of operation errMsg empty string in case of success or non-localized string that representing error condition otherwise errCode 0 in case of success or -1 in case of general error Example
// parsed JSON data JSON.parse(gSTB.GetStorageInfo('{}')); // execution result { errCode : 0, errMsg : "", result : [ { freeSize: 316776259584, fsType: 5, isReadOnly: 0, label: "", mediaType: 1, model: "HGST HTS545032A7", mountPath: "/media/HDD-SATA-1", partitionNum: 1, size: 320000000000, sn: "HDD-SATA-1", vendor: "ATA" } ] }
-
GetSubtitlePID
<static> GetSubtitlePID () → {number} -
Receive the number (PID) of the current subtitles track.
The list of all subtitles track determined by the player can be received with gSTB.GetSubtitlePIDs.
Returns:Type Description number
current subtitles track number [0..0x1fff]
-
GetSubtitlePIDs
<static> GetSubtitlePIDs () → {string} -
Get the list of subtitles track in the stream with the description of the language.
This string can be easily converted into a structure array by calling the function
eval
.This function must be called after the
event 2
occurs (see description of events)Returns:Type Description string
list of subtitles tracks found in the following format:
[{pid:<PID1>, lang:[<lang1_1>, <lang2_1>]}, ... , {pid:<PIDn>, lang:[<lang1_n>, <lang2_n>]}]
where:
Value Description PIDn PID of subtitle track with the number n lang1_n, lang2_n first two descriptions of languages in subtitle track number n 3-symbol tags according to ISO 639 Example
// execution result // 2 subtitle tracks in the stream: Russian having PID=114 and English having PID=115 '[{pid:114, lang:["rus", "ru"]}, {pid:115, lang:["eng", ""]}]'
-
GetTeletextPID
<static> GetTeletextPID () → {number} -
Get current teletext PID.
Returns:Type Description number
unique identifier of current teletext track
-
GetTeletextPIDs
<static> GetTeletextPIDs () → {string} -
Get a list of teletext tracks in the stream with the description of the language.
This string can be easily converted into a structure array by calling the function
eval
.This function must be called after the
event 2
occurs (see description of events).Returns:Type Description string
list of teletext tracks found in the following format:
[{pid:<PID1>, lang:[<lang1_1>, <lang2_1>]}, ... , {pid:<PIDn>, lang:[<lang1_n>, <lang2_n>]}]
where:
Value Description PIDn PID of teletext track with the number n lang1_n, lang2_n First two descriptions of languages in teletext track number n 3-symbol tags according to ISO 639 -
GetTopWin
<static> GetTopWin () → {number} -
Get current top window number.
Returns:Type Description number
number of window which is in top position now:
Value Description 0 graphic window 1 video window -
GetTransparentColor
<static> GetTransparentColor () → {number} -
Return the color considered transparent at the moment.
Returns:Type Description number
the color in RGB format considered transparent at the moment [0..0xffffff]
-
GetVideoInfo
<static> GetVideoInfo () → {string} -
Get information about current video content.
Function must be called after receiving
event 7
from List of the events used.Returns:Type Description string
string in the following form:
{frameRate:25000,pictureWidth:704,pictureHeight:576,hPAR:12,vPAR:11}
where:
Name Description frameRate video frame rate pictureWidth encoded video width pictureHeight encoded video height hPAR and vPAR pixel aspect ratio coefficients
in example above these params mean that movie aspect ratio is: (704*hPAR/vPAR)/576 = 1.333333333(3) = 4:3 for square pixels -
GetVolume
<static> GetVolume () → {number} -
Receive the volume level.
Returns:Type Description number
the current volume level [0..100]
-
GetWepKey64ByPassPhrase
<static> GetWepKey64ByPassPhrase ( passPhrase ) → {string} -
Return wep 64 bit keys for given password phrase.
Parameters:Name Type Description passPhrase
string
password phrase (1-32 symbols)
Returns:Type Description string
four 64 bit wep keys in JSON format
signature:
{result:{wep64-key1:string, wep64-key2:string, wep64-key3:string, wep64-key4:string}, errMsg:string, errCode:number}
Fields:
Name Description result holds result of operation errMsg empty string in case of success or non-localized string that representing error condition otherwise errCode 0 in case of success or -1 in case of general error Example
// parsed JSON data JSON.parse(gSTB.GetWepKey64ByPassPhrase('somepass')); // execution result { result: { wep64-key1: "8edb8b6507", wep64-key2: "bf2dd4fa63", wep64-key3: "082e6fbe06", wep64-key4: "4344499166" }, errMsg: "", errCode: 0 }
-
GetWepKey128ByPassPhrase
<static> GetWepKey128ByPassPhrase ( passPhrase ) → {string} -
Return wep 128 bit keys for given password phrase.
Parameters:Name Type Description passPhrase
string
password phrase (1-32 symbols)
Returns:Type Description string
128 bit wep key in JSON format
signature:
{result:{wep128-key1:string}, errMsg:string, errCode:number}
Fields:
Name Description result holds result of operation errMsg empty string in case of success or non-localized string that representing error condition otherwise errCode 0 in case of success or -1 in case of general error Example
// parsed JSON data JSON.parse(gSTB.GetWepKey128ByPassPhrase('somepass')); // execution result { result: { wep128-key1: "45ef5cf636b94e08c4ecb79ebf" }, errMsg: "", errCode: 0 }
-
GetWifiGroups
<static> GetWifiGroups () → {string} -
Make scan and return list of found wireless groups (SSID).
Returns:Type Description string
list of wireless groups info in JSON format
signature:
{result:{ssid:string, auth:string, enc:string, signalInfo:string, rfInfo:string}[], errMsg:string, errCode:number}
Fields:
Name Description result holds result of operation result[n].ssid name of group result[n].auth authentication method ("WPA", "WPA2", "WEPAUTO", "NONE") result[n].enc encoding ("CCMP", "TKIP", "NONE") result[n].signalInfo signal strength (numeric value in dB) result[n].rfInfo string information about channel errMsg empty string in case of success or non-localized string that representing error condition otherwise errCode 0 in case of success or -1 in case of general error Signal strength:
Value Description <= -80 20% <= -70 40% <= -60 60% <= -50 80% <= 0 100% Example
// parsed JSON data JSON.parse(gSTB.GetWifiGroups()); // execution result { result: [ { ssid: "dlink", auth: "WPA2", enc: "TKIP", signalInfo: "-47", rfInfo: "Frequency:2.412 GHz (Channel 1)" }, { ssid: "linksys3E66", auth: "WEPAUTO", enc: "WEP", signalInfo: "-67", rfInfo: "Frequency:2.427 GHz (Channel 4)" } ], errMsg: "", errCode: 0 }
-
GetWifiLinkStatus
<static> GetWifiLinkStatus () → {boolean} -
Get link status of WiFi network interface.
Returns:Type Description boolean
possible values:
Value Description true link is active false no connection to wifi access point -
GetWifiLinkStatusEx
<static> GetWifiLinkStatusEx () → {string} -
Return attributes for current WiFi connection if available.
Returns:Type Description string
connection info in JSON format
Example
// parsed JSON data JSON.parse(gSTB.GetWifiLinkStatusEx()); // execution result { "Bit Rate" : 0, // in Mb/s "Frequency" : 0.000000000000000, // in GHz "Noise level" : 0, "Signal level" : 0 }
-
GetWinAlphaLevel
<static> GetWinAlphaLevel ( winNum ) → {number} -
Receive the level of alpha transparency for the set window.
Parameters:Name Type Description winNum
number
number of the window for which this function is used:
Value Description 0 graphic window 1 video window Returns:Type Description number
the current value of alpha transparency for video window [0..255]
-
HideVirtualKeyboard
<static> HideVirtualKeyboard () -
Hide the virtual keyboard from the screen.
-
IgnoreUpdates
<static> IgnoreUpdates ( mode ) -
Block or unblock the screen browser upgrade.
Parameters:Name Type Description mode
boolean
possible values:
Value Description true after this call the graphic window stops upgrading till the next call with the parameter false false after this call the graphic window resumes upgrading – passing to normal mode -
InitPlayer
<static> InitPlayer () -
Initialize the player.
Should be called before the first use of the player.
-
IsFileExist
<static> IsFileExist ( fileName ) → {boolean} -
Test is file name point to existing file.
Parameters:Name Type Description fileName
string
absolute file path which will be tested
Returns:Type Description boolean
possible values:
Value Description true file name is an absolute path and it points to an existing file false otherwise -
IsFileUTF8Encoded
<static> IsFileUTF8Encoded ( fileName ) → {boolean} -
Check if the given file has UTF8 encoding.
Parameters:Name Type Description fileName
string
file to test
Returns:Type Description boolean
check result
-
IsFolderExist
<static> IsFolderExist ( fileName ) → {boolean} -
Test is file name point to existing folder.
Parameters:Name Type Description fileName
string
absolute file path which will be tested
Returns:Type Description boolean
possible values:
Value Description true file name is an absolute path and it points to an existing folder false otherwise -
IsInternalPortalActive
<static> IsInternalPortalActive () → {boolean} -
This function indicating that internal portal been started.
Returns:Type Description boolean
true when internal portal has been started
-
IsPlaying
<static> IsPlaying () → {boolean} -
Receive the current state of player.
Returns:Type Description boolean
possible values:
Value Description true currently is playing false currently is not playing -
IsVirtualKeyboardActive
<static> IsVirtualKeyboardActive () -
- To Do:
-
- add description
-
IsVirtualKeyboardActiveEx
<static> IsVirtualKeyboardActiveEx () -
- To Do:
-
- add description
-
ListDir
<static> ListDir ( dirName, lastModified ) → {string} -
Return the list of directories and files having the extension set with gSTB.SetListFilesExt, located in the directory dirName.
Parameters:Name Type Description dirName
string
route to the directory the contents whereof must be received
lastModified
boolean
flag is the last modification time is necessary
Returns:Type Description string
the string in the following form is returned:
var dirs = ["dir1/", ..., "dirN/", ""]
var files = [{"name":"fileName1", "size":size1}, ..., {"name":"fileNameM", "size":sizeM}]
where:
Value Description dirN the name of N-sub-directory fileNameM and sizeM name and size of M-file -
LoadCASIniFile
<static> LoadCASIniFile ( iniFileName ) -
Load CAS settings from the set file.
See instruction on adjusting CAS Verimatrix in the supplement.
The call of the function becomes effective only if made before gSTB.SetCASType.
Parameters:Name Type Description iniFileName
string
address of the settings file in the root file system
-
LoadExternalSubtitles
<static> LoadExternalSubtitles ( url ) -
Load text subtitles from external subtitle file of srt, sub, ass formats.
If subtitles are loaded successfully then external subtitle track will be added to subtitle track list with number(PID) 0x2000.
If any error occurs while loading subtitles then JS API user will receive
event 8
from List of the events used.Parameters:Name Type Description url
string
external subtitles address
can be a local URL:
/media/USB-.../subtitles.srt
and URL from HTTP server:http://192.168.1.1/subtitles.srt
-
LoadURL
<static> LoadURL ( url ) -
Reload portal window from the specified URL.
Parameters:Name Type Description url
string
new portal window address
-
LoadUserData
<static> LoadUserData ( fileName ) → {string} -
Load file from
/mnt/Userfs/data/*
.Parameters:Name Type Description fileName
string
name of the file with data
Returns:Type Description string
file content
Example
// get content of the file mnt/Userfs/data/test gSTB.LoadUserData('test');
-
Pause
<static> Pause () -
Pause current playback.
gSTB.Continue continues playing from the current position.
-
Play
<static> Play ( playStr, proxyParams ) -
Start playing media content as specified in playStr.
Can use the given proxy server for HTTP playback.
Proxy server settings are valid till the next call of gSTB.Play.
Parameters:Name Type Argument Description playStr
string
format:
solution URL [position:pnum] [atrack:anum] [vtrack:vnum] [strack:snum] [subURL:subtitleUrl]
Option Description solution Media content type. Depends on the IPTV-device type (see Appendix 2 for the table of supported formats and the description of media content types). URL Address of the content to be started for playing. Depends on the type (see more detailed information in Appendix 2). atrack:anum Sets the number(PID) of audio track (optional parameter). vtrack:vnum Sets the number(PID) of audio track (optional parameter). strack:snum Sets the number(PID) of subtitle track (optional parameter). subURL:subtitleURL Sets the URL of external subtitles file. See gSTB.LoadExternalSubtitles (optional parameter). proxyParams
string
<optional>
format:
http://[username[:password]@]proxy_addr:proxy_port
Proxy server settings are affect only HTTP playback and valid till the next call of gSTB.Play.
-
PlaySolution
<static> PlaySolution ( solution, url ) -
Play media content of the preset type (solution) from the preset URL.
Parameters:Name Type Description solution
string
corresponds to the parameter solution from the function gSTB.Play
url
string
address of the content to be started for playing
depends on the type (see more detailed information in supplement 2)
-
RDir
<static> RDir ( value ) → {string} -
Perform script
/home/default/rdir.cgi
with set parameters and return the standard output of this script.The rdir.cgi supplied with the root file system has several commands presets:
Command Description SerialNumber x returns serial number of this device to x MACAddress receive MAC address IPAddress receive IP address (wired) WiFi_ip receive IP address (wifi) HardwareVersion receive hardware version Vendor receive the name of STB manufacturer Model receive the name of STB pattern ImageVersion receive the version of the software flash image ImageDescription receive the information on the image of the software flash ImageDate receive the date of creation of the flash software image getenv v_name receive the value of environment variable with the name v_name
see detailed description of operations with environment variables in supplement 11setenv v_name value set environment variable with the name v_name to the value value
See detailed description of operations with environment variables in supplement 11ResolveIP hostname resolve hostname to IP address SHA1 text calculate SHA1 checksum Parameters:Name Type Description value
string
contains parameters with which the script
/home/default/rdi.cgi
is startedReturns:Type Description string
standard output received by performing the script with parameters set
Examples
// mount anonymous SMB share gSTB.RDir('mount cifs "//192.168.1.91/some share name" "/ram/mnt/smb" username=guest,password=,iocharset=utf8');
// mount SMB share with credentials gSTB.RDir('mount cifs "//192.168.1.91/some share name" "/ram/mnt/smb" username=some_name,password=some_pass,iocharset=utf8');
// mount NFS share gSTB.RDir('mount nfs "192.168.1.72:/home/user/share" "/ram/mnt/nfs" nolock,ro,rsize=4096,wsize=4096,udp');
// hardware info gSTB.RDir('SerialNumber'); // execution result '052012B031491'
-
ReadCFG
<static> ReadCFG () → {string} -
Read the file of portal settings
/etc/stb_params
.Returns:Type Description string
the contents of the file
/etc/stb_params
-
ResetUserFs
<static> ResetUserFs () -
Clear all User File System data.
-
ResetWebProxy
<static> ResetWebProxy () -
Disable sending all requests through proxy.
-
Rotate
<static> Rotate ( angle ) -
Rotate video. Can rotate images on other platforms.
Platform: MAG100
Parameters:Name Type Description angle
number
rotates the video window contents by the preset angle relative to the initial position
allowed values: 0, 90, 180, 270.
-
SaveUserData
<static> SaveUserData ( fileName, fileData ) -
Save file at
/mnt/Userfs/data/*
.Parameters:Name Type Description fileName
string
file name
fileData
string
data for saving
-
SendEventToPortal
<static> SendEventToPortal ( event ) -
Send an event to portal WebKit window.
You can handle the event by defining event handler:
stbEvent.onPortalEvent(string)
.Parameters:Name Type Description event
string
this argument will be passed to event handler stbEvent.onPortalEvent
-
ServiceControl
<static> ServiceControl ( serviceName, action ) → {string} -
Execute control actions for background service.
Parameters:Name Type Description serviceName
string
service name (e.g. "network", "pppoe", "wifi")
action
string
action to execute for given service (e.g. "start", "stop", "restart")
Returns:Type Description string
status data in JSON format
signature:
{result:{status:string}, errMsg:string, errCode:number}
Fields:
Name Description result holds result of operation result.status value is always "ok" errMsg empty string in case of success or non-localized string that representing error condition otherwise errCode 0 in case of success or -1 in case of general error Example
// parsed JSON data JSON.parse(gSTB.ServiceControl('name', 'action')); // execution result { result: { status: "ok" }, errMsg: "", errCode: 0 }
-
Set3DConversionMode
<static> Set3DConversionMode ( mode ) -
Set 3D conversion mode.
Parameters:Name Type Description mode
number
possible values:
Value Description 0 Treat video as normal 2D video. Default mode. In case of top-bottom or side-by-side 3D video player displays both stereo views so TV can reproduce 3D video (with half resolution). 1 Treat video as 3D video in top-bottom(over-under) format with half resolution of each stereo view. In that mode player will stretch top half of the video into fullscreen according to specified aspect. 2 Treat video as 3D video in top-bottom(over-under) format with full resolution of each stereo view. In that mode player will stretch top half of the video into fullscreen according to specified aspect. The difference between STB_3D_MODE_TOP and STB_3D_MODE_TOP_HALF is that STB_SetAspect with other than auto mode gives different behaviour and in case of resulting video will be Full resolution HD. 3 Treat video as 3D video in side-by-side format with half resolution of each stereo view. In that mode player will stretch left half of the video into fullscreen according to specified aspect. -
SetAdditionalCasParam
<static> SetAdditionalCasParam ( paramName, paramValue ) -
Set additional CAS parameters.
Call of the function becomes effective only if made before gSTB.SetCASType.
Parameters:Name Type Description paramName
string
additional parameter name
paramValue
string
additional parameter value
-
SetAlphaLevel
<static> SetAlphaLevel ( alpha ) -
Set alpha transparency of the video window.
Parameters:Name Type Description alpha
number
transparency of the video window (0 - completely transparent, 255 - completely opaque)
-
SetAspect
<static> SetAspect ( aspect ) -
Set video picture format.
Player uses aspL only in windows mode, while aslH only in full screen mode (see gSTB.SetPIG).
See gSTB.GetAspect.
Parameters:Name Type Description aspect
number
sets the video picture format
consists of 2 tetrads:
7 6 5 4 3 2 1 0 aspH aspL aspL - the aspect ratio:
Value Description 0 automatic 1 20:9 2 16:9 3 4:3 aspH - conversion of video format:
Value Description 0 as it is (video is stretched for the whole screen) 1 Letter box mode (video is proportionally enlarged to the size of the screen along the larger edge) 2 Pan&Scan mode (video is proportionally enlarged to the screen size along the lesser edge) 3 combined mode (intermediate between Letter Box Box and Pan&Scan) 4 enlarged mode 5 optimal mode Example
// Stretch gSTB.SetAspect(0x00); // Fit on gSTB.SetAspect(0x10); // Zoom gSTB.SetAspect(0x40); // Optimal gSTB.SetAspect(0x50);
-
SetAudioLangs
<static> SetAudioLangs ( priLang, secLang ) -
Set languages of audio tracks to be automatically selected when receiving the information on the channel.
Each param is a 3–symbol tags according to ISO 639, for example: "rus" or "eng".
If the information of several audio tracks is present the player selects the track preset by the language priLang.
If such track is not found, the track with the language secLang is selected.
If this one is not found either the first track from the list is selected.
Parameters:Name Type Description priLang
string
primary language
secLang
string
secondary language
-
SetAudioOperationalMode
<static> SetAudioOperationalMode ( mode ) -
Set Operational Mode for DolbyDigital audio.
Affects only DolbyDigital audio.
Parameters:Name Type Description mode
number
possible values:
Value Description 0 RF mode 1 Line mode 2 Custom0 3 Custom1 -
SetAudioPID
<static> SetAudioPID ( pid ) -
Set track number (PID) for audio.
Parameters:Name Type Description pid
number
sets the number or PID of the audio track to be played in the current content
if such track is absent the sound will be disabled
-
SetAutoFrameRate
<static> SetAutoFrameRate ( mode ) -
Set the current AutoFrameRate mode, which allows to automatically switch frame rate of HDMI video output according to a content frame rate.
Auto frame rate switching works with ffmpeg, file, ffrt2, ffrt3 solutions if player has managed to detect frame rate of content.
Auto frame rate switching works only on HDMI output in the following modes: 720p-50/60, 1080i-50/60 and 1080p-50/60. In 720p-50/60 modes player can switch only to 720p-50/60 modes.
After stopping playback video output switches back to original frame rate.
Warning: Not every TV supports 1080p-24 video mode.
Parameters:Name Type Description mode
number
contains bit flags which specify a set of frame rates to which video output can automatically switch:
Value Description 1 can switch to 1080p-24 mode 2 can switch to 720p-50, 1080i-50, 1080p-50 modes 4 can switch to 720p-60, 1080i-60, 1080p-60 Example
// disables auto frame rate switching gSTB.SetAutoFrameRate(0); // enables switching to frame rates 24,50 and 60 gSTB.SetAutoFrameRate(7);
-
SetBrightness
<static> SetBrightness ( brightness ) -
Set the brightness of video output in SD mode.
Parameters:Name Type Description brightness
number
brightness in the SD mode [1..254]
-
SetBufferSize
<static> SetBufferSize ( sizeInMs, maxSizeInBytes ) -
Set input buffer size for buffering support.
Buffering works only with the following solutions: ffmpeg, ffrt, ffrt2, ffrt3, fm, file.
After start of playback with mentioned above solution the following stages take place:
- opening content for playback
- determining content information (raised
event 2
from List of the events used) - input buffer filling stage
- after complete buffer filling stream data go to decoding
- decoded data go to outputs (raised
event 4
from List of the events used)
Parameters:Name Type Description sizeInMs
number
buffer size in ms
maxSizeInBytes
number
maximum buffer size in bytes
used ONLY to limit maximum amount of allocated memory but not as the primary buffer size
-
SetCASDescrambling
<static> SetCASDescrambling ( isSoftware ) -
Set hard or soft mode of descrambling.
At present the use of the function is expedient only for CAS Verimatrix.
Depending on the mode set, the player can descramble only the streams scrambled by the following algorithm:
- Soft mode: RC4, AES
- Hard mode: AES, DVB-CSA
This mode is set only once after the start of the portal.
The call of the function becomes effective only if it is called before gSTB.SetCASType.
Parameters:Name Type Description isSoftware
number
possible values:
Value Description 0 use hard descrambling 1 use soft descrambling In the absence of this call soft descrambling is used.
-
SetCASParam
<static> SetCASParam ( serverAddress, serverPort, companyName, opID, errorLevel ) -
Set CAS server parameters.
Call of the function becomes effective only if made before gSTB.SetCASType.
Parameters:Name Type Description serverAddress
string
CAS server URL
serverPort
number
CAS server port
companyName
string
name of the company under which this operator is registered on CAS server
opID
number
operator identifier used by STB (if opID is equal to -1, the value is not updated)
errorLevel
number
level of error (0 – minimal level, if error Level equals -1 it is not updated)
-
SetCASType
<static> SetCASType ( type ) -
Set default access server type after each start of the portal.
Set default server type once after each start of the portal.
Parameters:Name Type Description type
number
possible values:
Value Description 0 not set 1 Verimatrix 2 SecureMedia 4-10 custom CAS plugin with corresponding number -
SetCheckSSLCertificate
<static> SetCheckSSLCertificate ( enable ) -
Enable or disable SSL certificate checking while playing back HTTPS streams.
Parameters:Name Type Description enable
number
possible values:
Value Description 0 disable check 1 enable check (default) -
SetChromaKey
<static> SetChromaKey ( key, mask ) -
Set the preset color and mask for using as ChromaKey (the transparency of any color on the whole window).
Any changes on the screen shall be visible only subject to switching on the regime ChromaKey by the functions gSTB.SetMode or gSTB.SetWinMode.
Parameters:Name Type Description key
number
sets the color in RGB
if the color of a window pixel coincides with this color after masking, the pixel is considered transparent
mask
number
set the mask for key
if the mask is equal to 0xffffff, the color set by the parameter key is considered transparent
-
SetComponentMode
<static> SetComponentMode ( mode ) -
Switch RGB/YUV Component output mode.
Parameters:Name Type Description mode
number
possible values:
Value Description 0 YUV mode 1 RGB mode (available only for SD mode) -
SetContrast
<static> SetContrast ( level ) -
Set contrast of video output in SD mode.
Parameters:Name Type Description level
number
video output contrast in SD mode [-128..127]
-
SetCustomHeader
<static> SetCustomHeader ( headerStr ) -
Set custom header that will be inserted into all HTTP and RTSP requests from player.
Takes effect on next playback.
Parameters:Name Type Description headerStr
string
custom HTTP header without new line
Example
gSTB.SetCustomHeader('CustomHeader1: value1');
-
SetDefaultFlicker
<static> SetDefaultFlicker ( state ) -
Turn on/off flicker-filter with the default parameters.
Flicker filter is applicable only for graphic window, this is why it is recommended to set its only once and keep it switched.
Parameters:Name Type Description state
number
possible values:
Value Description 0 switch off 1 switch on (default values for sharpness and flicker are set) -
SetDRC
<static> SetDRC ( high, low ) -
Set dynamic range compression for DolbyDigital audio.
Parameters:Name Type Description high
number
compression level for high range (0 – DRC is off)
low
number
compression level for low range (0 – DRC is off)
-
SetEnv
<static> SetEnv ( envList ) → {boolean} -
Setup values of specified boot loader’s variables.
Parameters:Name Type Description envList
string
set of variables (name and value) in JSON format
If referencing variable does not exist it will be created. If new value is empty string then value will be deleted.
Returns:Type Description boolean
operation status
Example
gSTB.SetEnv('{"tvsystem":"720p-60", "language":"en"}'));
-
SetFlicker
<static> SetFlicker ( state, flk, shp ) -
Set flicker-filter parameters.
Flicker filter is applicable only for graphic window, therefore it is advised to set it only once during loading and not to switch it off.
flk and shp parameters are ignored.
Parameters:Name Type Description state
number
possible values:
Value Description 0 switch off the flicker-filter 1 switch on the flicker-filter flk
number
flicker level
shp
number
sharpness level
-
SetHDMIAudioOut
<static> SetHDMIAudioOut ( type ) -
Set HDMI audio format.
Parameters:Name Type Description type
number
possible values:
Value Description 0 HDMI transmits PCM audio 1 HDMI transmits S/PDIF audio (in that case S/PDIF output mode is set by gSTB.SetupSPdif) -
SetInputLang
<static> SetInputLang ( langId ) -
Set new input language.
Parameters:Name Type Description langId
string
language unique identifier to be set as input language
-
SetInternalPortalActive
<static> SetInternalPortalActive () -
- To Do:
-
- add description
-
SetLedIndicatorLevels
<static> SetLedIndicatorLevels ( baseLevel, blinkLevel ) -
Set the LED indicator brightness level.
Parameters:Name Type Description baseLevel
number
blinkLevel
number
- Since:
- 2.18
-
SetLedIndicatorMode
<static> SetLedIndicatorMode ( mode ) -
Set the LED indicator mode.
Parameters:Name Type Description mode
number
possible values:
Value Description 0 off 1 normal 2 standby - Since:
- 2.18
-
SetListFilesExt
<static> SetListFilesExt ( fileExtensions ) -
Set the list of file extensions for returning to the function gSTB.ListDir.
Parameters:Name Type Description fileExtensions
string
list of files extensions followed by a space
Example
gSTB.SetListFilesExt('.mkv .mov .mpg');
-
SetLoop
<static> SetLoop ( loop ) -
Set or cancels repeated playing.
Parameters:Name Type Description loop
number
possible values:
Value Description 0 switch off repeated playing on the content 1 switch on repeated playing on the content -
SetMicVolume
<static> SetMicVolume ( micVol ) -
Set the microphone volume level.
Platform: MAG100
Parameters:Name Type Description micVol
number
set the microphone volume level [0..100]
(0 – minimal volume, 100 – maximal volume)
-
SetMode
<static> SetMode ( mode ) -
Switch on (mode=1) or switch off (mode=0) the mode ChromaKey for the video window.
Parameters:Name Type Description mode
number
ChromaKey mode for the video window (0 – off, 1 – on)
the parameters set by gSTB.SetChromaKey and gSTB.SetTransparentColor shall be valid if the on-mode is used
-
SetMulticastProxyURL
<static> SetMulticastProxyURL ( proxyAddress ) -
Set URL for multicast proxy.
Parameters:Name Type Description proxyAddress
string
proxy address in the following form:
http://address[:port]
-
SetMute
<static> SetMute ( mute ) -
Switch off or on the sound restoring the volume level.
After the cycle of switching off/on with this function is completed the volume level remains unchanged.
Parameters:Name Type Description mute
number
switches on/off the sound (0 – on, 1 – off)
-
SetNativeStringMode
<static> SetNativeStringMode ( mode ) -
True to apply new native string handling without utf8/utf16 encoding/decoding.
Parameters:Name Type Description mode
boolean
true - all string manipulations are with utf16 strings
-
SetObjectCacheCapacities
<static> SetObjectCacheCapacities ( cacheMinDeadCapacity, cacheMaxDead, totalCapacity ) -
Set WebKit cache capacity.
For testing purpose only.
Parameters:Name Type Description cacheMinDeadCapacity
number
cacheMaxDead
number
totalCapacity
number
- Deprecated:
- Yes
-
SetPCRModeEnabled
<static> SetPCRModeEnabled ( enable ) -
Set special playback mode.
For testing purpose only.
Parameters:Name Type Description enable
boolean
- Deprecated:
- Yes
-
SetPIG
<static> SetPIG ( state, scale, x, y ) -
Set position and mode of video window.
Parameters:Name Type Description state
number
possible values:
Value Description 0 show the video in the specified rectangle 1 show the video on full screen scale
number
the scale of the video window
the present multiplier of the video window size equals to scale/256
x
number
horizontal offset of the upper left corner of the video window from the screen edge
y
number
vertical offset of the upper left corner of the video window from the screen edge
-
SetPixmapCacheSize
<static> SetPixmapCacheSize ( sizeKb ) -
Set cache limit for pixmaps.
For testing purpose only.
Parameters:Name Type Description sizeKb
number
- Deprecated:
- Yes
-
SetPosPercent
<static> SetPosPercent ( prc ) -
Set the current position in percent.
Parameters:Name Type Description prc
number
the position in percent [0..100] of the total duration of the content where playback should start
-
SetPosPercentEx
<static> SetPosPercentEx ( prc ) -
Set the current position in hundredth fractions of percent.
Parameters:Name Type Description prc
number
position in hundredth fractions of percent [0..10000] of the total duration of the content, from which the playback should start
-
SetPosTime
<static> SetPosTime ( time ) -
Set the new position of playback in time.
Parameters:Name Type Description time
number
the position in seconds (time >= 0) from the beginning of the content where the playback should start (positioning in the content)
-
SetPosTimeEx
<static> SetPosTimeEx ( time ) -
Set the current playback position in time (ms).
Parameters:Name Type Description time
number
position in ms (time >= 0) from the beginning of the content where playback should start (positioning in the content)
-
SetSaturation
<static> SetSaturation ( sat ) -
Set the saturation of video output in SD mode.
Parameters:Name Type Description sat
number
saturation of video output in SD mode [1..254]
-
SetScreenSaverInitAttr
<static> SetScreenSaverInitAttr ( options ) -
Set a screensaver window init parameters.
Parameters:Name Type Description options
string
parameters from function stbWindowMgr.windowInit
- Since:
- 2.18
-
SetScreenSaverTime
<static> SetScreenSaverTime ( timeSec ) -
Set a screensaver activation time on idle.
Parameters:Name Type Description timeSec
number
0 - disable screensaver, 1-59 value ceiling to 60
-
SetSettingsInitAttr
<static> SetSettingsInitAttr ( options ) -
Set the system settings window init parameters.
Parameters:Name Type Description options
string
parameters from function stbWindowMgr.windowInit
- Since:
- 2.18
-
SetSpeed
<static> SetSpeed ( speed ) -
Set the rate of playing.
Parameters:Name Type Description speed
number
sets new playback speed [-8..8]
Value Description 1 normal 2 2x 3 4x 4 8x 5 16x 6 1/2 7 1/4 8 12x -1 reverse -2 reverse 2x -3 reverse 4x -4 reverse 8x -5 reverse 16x -8 reverse 12x -
SetStereoMode
<static> SetStereoMode ( mode ) -
Set stereo mode.
Mono, Mono left and Mono right modes affect only Dual Mono DolbyDigital audio.
Parameters:Name Type Description mode
number
possible values:
Value Description 0 Stereo mode. 1 Mono mode. Left and right channels are mixed and sent to both audio outputs. 2 Mono left. Left channel audio are sent to both audio outputs. 3 Mono right. Right channel audio are sent to both audio outputs. 4 Lt/Rt mode. -
SetSubtitleLangs
<static> SetSubtitleLangs ( priLang, secLang ) -
Set the languages of subtitles tracks to be automatically selected when receiving the information on the channel.
Each param is a 3–symbol tags according to ISO 639 (e.g. "rus" or "eng").
If the information of several audio tracks is present the player selects the track preset by the language priLang.
If such track is not found, the track with the language secLang is selected.
If this one is not found either the first track from the list is selected.
Parameters:Name Type Description priLang
string
primary language
secLang
string
secondary language
-
SetSubtitlePID
<static> SetSubtitlePID ( pid ) -
Set the number of track (PID) for subtitles.
Parameters:Name Type Description pid
number
set the number or PID for the subtitles track to be played in the current content
if this track is absent subtitles will be disabled
-
SetSubtitles
<static> SetSubtitles ( mode ) -
Set subtitle mode.
For MAG100 subtitles are displayed only in full screen mode.
Parameters:Name Type Description mode
boolean
possible values:
Value Description true subtitles on false subtitles off -
SetSubtitlesColor
<static> SetSubtitlesColor ( rgbColor ) -
Set color for text subtitles.
Parameters:Name Type Description rgbColor
number
color in RGB format
Example
// set gray color of text subtitles gSTB.SetSubtitlesColor(0x808080);
-
SetSubtitlesEncoding
<static> SetSubtitlesEncoding ( encoding ) -
Set the encoding which will be used to display external subtitles.
Parameters:Name Type Description encoding
string
encoding for external subtitles
for example: "utf-8", "cp1250", "cp1251", "cp1252", ..., "cp1258", "iso8859-1", ... , "iso8859-16"
-
SetSubtitlesFont
<static> SetSubtitlesFont ( font ) -
Set the font for displaying text subtitles.
Parameters:Name Type Description font
string
font file address in the root file system (e.g.
/home/default/arial.ttf
) -
SetSubtitlesOffs
<static> SetSubtitlesOffs ( offset ) -
Set the offset for displaying text subtitles.
Parameters:Name Type Description offset
number
horizontal offset of subtitles
-
SetSubtitlesSize
<static> SetSubtitlesSize ( size ) -
Set the size of text subtitles (in pixels).
Parameters:Name Type Description size
number
size of text subtitles
-
SetSyncCorrection
<static> SetSyncCorrection ( intVal1, intVal2 ) -
For testing purpose only.
Parameters:Name Type Description intVal1
number
intVal2
number
- Deprecated:
- Yes
-
SetSyncOffsetCorrection
<static> SetSyncOffsetCorrection ( intVal ) -
For testing purpose only.
Parameters:Name Type Description intVal
number
- Deprecated:
- Yes
-
SetSyslogLevel
<static> SetSyslogLevel ( level ) -
Setup logging level via JS API.
This function just enables logging to syslog but does not start/configure syslogd.
syslogd should be configured (if needed) by operator who creates custom software images.
Parameters:Name Type Description level
number
logging level which should be OR-ed value of the following levels:
Value Description 0 quiet level, logging disabled (default) 1 error level, e.i. "RTP counter error", "TS Continuity Counter error", "Video decoding error" 2 warning level 4 info level, e.i. "Starting playback", "External subtitles opening error", "Content opening error", "End of Stream" 8 debug level, e.i.: gSTB.Debug from JS API do not filter frequent error events. By default logging is set to quiet mode.
Example
// enables error(1) and info(4) logging levels gSTB.SetSyslogLevel(5);
-
SetTeletext
<static> SetTeletext ( mode ) -
Enable/disable teletext.
Parameters:Name Type Description mode
boolean
possible values:
Value Description true enable teletext false disable teletext -
SetTeletextPID
<static> SetTeletextPID ( pid ) -
Set track number (PID) for teletext.
Parameters:Name Type Description pid
number
sets the number or PID of the teletext track to be played in the current content
-
SetTopWin
<static> SetTopWin ( winNum ) -
Set the preset window over others.
Parameters:Name Type Description winNum
number
number of the window for which this function is used:
Value Description 0 graphic window 1 video window -
SetTransparentColor
<static> SetTransparentColor ( color ) -
Set the color considered transparent at the moment.
The function is a special case of gSTB.SetChromaKey.
Any changes on the screen are visible only provided the ChromaKey mode is switched on by functions gSTB.SetMode or gSTB.SetWinMode.
Parameters:Name Type Description color
number
color in RGB format that can be considered transparent [0..0xffffff]
-
SetUiLang
<static> SetUiLang ( langId ) -
Set the user interface language.
Attention! This function also causes gSTB.SetInputLang.
Parameters:Name Type Description langId
string
-
SetupRTSP
<static> SetupRTSP ( type, flags ) -
Set client to STB.
Parameters:Name Type Description type
number
supported RTSP-server types:
Value Description 0 RTSP server based on VLC 1 BitBand RTSP server 2 Kasenna RTSP server 3 ARRIS (C-COR) RTSP server 4 Live555 RTSP server 5 ZTE RTSP server 6 Netup RTSP server flags
number
control flags:
Value Description 1 switch on the keep-alive mode 2 determination of the stream end by the field x-notice in the message ANNOUNCE from the server 4 determination of te stream end by the field x-notice in the answer to GET_PARAMETER 8 determination of the stream end after a period of time of the video stream from the server absence 16 (0x10) determination of the stream end by the field according to the field rtptime sent in the RTP heading of the package (only for the mode of sending video under RTP) 32 (0x20) Use UDP transport to send video -
SetupSPdif
<static> SetupSPdif ( mode ) -
Set the mode of sound output through S/PDIF.
Parameters:Name Type Description mode
number
possible values:
Value Description 0 the sound is supplied only to analogue output 1 sound is supplied to analogue output and through S/PDIF in tne format 2-channel PCM 2 sound is supplied to S/PDIF without decoding (AC3 ...), if supported by codec, otherwise through S/PDIF in the format of 2-channel PCM -
SetUserFlickerControl
<static> SetUserFlickerControl ( mode ) -
Set the control mode of flicker-filter.
See gSTB.SetFlicker, gSTB.SetDefaultFlicker.
Platform: MAG100
Parameters:Name Type Description mode
number
possible values:
Value Description 0 API user controls flicker-filter himself. 1 The player automatically switches on flicker-filter during pauses and stops and switches it off during playing. -
SetVideoControl
<static> SetVideoControl ( mode ) -
Set the video window control mode.
Parameters:Name Type Description mode
number
possible values:
Value Description 0 the device automatically switches on the video window at the beginning of playing and switches it off when stops 1 API user uses gSTB.SetVideoState for instructing whether to show the video window or not -
SetVideoState
<static> SetVideoState ( state ) -
Switch on/off the video window.
Valid only if user control had been allowed with gSTB.SetVideoControl.
Parameters:Name Type Description state
number
allow/prohibit video display:
Value Description 0 video window is not displayed 1 video window is displayed if the stream is present -
SetViewport
<static> SetViewport ( xSize, ySize, x, y ) -
Set the location and size of the video window.
Parameters
xSize
andySize
depends on the screen resolution.Parameters:Name Type Description xSize
number
horizontal size of the video window (width)
ySize
number
vertical size of the video window (height)
x
number
left upper corner of the video window horizontal offset from the screen edge
must not exceed the screen width in sum with
xSize
y
number
left upper cornet of the video window vertical offset from the screen edge
must not exceed the screen width in sum with
ySize
-
SetViewportEx
<static> SetViewportEx ( xSize, ySize, xPos, yPos, clipXSize, clipYSize, clipXPos, clipYPos, saveClip ) -
Set video plane position and size in pixels and clipping rectangle for input video. More flexible version of gSTB.SetViewport.
Clip rectangle specifies which sub-rectangle will be shown in specified video window rectangle (stretched to fill whole video window). If clip_xsize==0 or clip_ysize==0 then clip will be ignored.
If clip rectangle is ignored or has size equal to encoded video size then aspect ratio conversion will be performed inside specified video window rectangle according to the current aspect for fullscreen mode. This does not depend on specified video window size. At the same time gSTB.SetViewport function does aspect ratio conversion only in fullscreen mode.
Clip rectangle size and position should be in pixels of the encoded video. Width and height of encoded video can be retrieved via gSTB.GetVideoInfo. See pictureWidth and pictureHeight.
Parameters:Name Type Description xSize
number
horizontal size of the video window (width)
ySize
number
vertical size of the video window (height)
xPos
number
left upper corner of the video window horizontal offset from the screen edge
must not exceed the screen width in sum with
xSize
yPos
number
left upper cornet of the video window vertical offset from the screen edge
must not exceed the screen width in sum with
ySize
clipXSize
number
clip rectangle horizontal size
clipYSize
number
clip rectangle vertical size
clipXPos
number
clip rectangle horizontal offset related to encoded video
clipYPos
number
clip rectangle vertical offset related to encoded video
saveClip
boolean
whether player should save clip region over the sequential playbacks:
Value Description true use this clip only for current playback false use this clip till next call of STB_SetViewportEx, STB_SetViewport, STB_SetPIG -
SetVolume
<static> SetVolume ( volume ) -
Set volume level.
Parameters:Name Type Description volume
number
volume level (0 - no sound, 100 - maximal level)
-
SetWebMode
<static> SetWebMode () -
- To Do:
-
- add description
-
SetWebProxy
<static> SetWebProxy ( proxyAddress, proxyPort, userName, password, excludeList ) -
Given proxy settings are only applied to
http://
orhttps://
requests of the browser, but not applied to content playback from HTTP server.For this purpose please use extended gSTB.Play using proxy server.
Parameters:Name Type Description proxyAddress
string
proxy server address
proxyPort
number
proxy server port
userName
string
user name for proxy server (can be empty)
password
string
password for proxy server (can be empty)
excludeList
string
proxy exclude list delimited by spaces
access to any entry in the list is performed directly, without proxy e.i.
youtube.com .lenta.ru 192.168.1.1/24 192.168.1.*
-
SetWinAlphaLevel
<static> SetWinAlphaLevel ( winNum, alpha ) -
Set alpha transparency of the preset window.
Parameters:Name Type Description winNum
number
number of the window for which this function is used:
Value Description 0 graphic window 1 video window alpha
number
transparency of the preset window (0 – completely transparent, 255 – completely opaque)
-
SetWinMode
<static> SetWinMode ( winNum, mode ) -
Switch on/off the ChromaKey mode for the preset window.
Parameters:Name Type Description winNum
number
the number of the window for which this function is used:
Value Description 0 graphic window 1 video window mode
number
ChromaKey mode for video window (0 – off, 1 – on)
the parameters set by gSTB.SetChromaKey or gSTB.SetTransparentColor shall be active in the on-mode
-
ShowSubtitle
<static> ShowSubtitle ( start, end, text ) -
Show text string as a subtitle on screen.
In case when start and end equal 0, text is shown on screen immediately until next gSTB.ShowSubtitle is called or 30 seconds elapsed.
If this function was called then subtitles will work only via gSTB.ShowSubtitle until next call of gSTB.Play.
Parameters:Name Type Description start
number
string presentation start time in ms from start of current media
end
number
string presentation end time in ms from start of current media
text
string
this text will be shown on screen as a subtitle
-
ShowVideoImmediately
<static> ShowVideoImmediately ( mode ) -
Set whether to show video only after video synchronization established after seeking or starting playback.
Experimental function.
Parameters:Name Type Description mode
boolean
possible values:
Value Description true Do not wait for video synchronization and start to show video as soon as possible. Can lead to jerky video for a few seconds right after channel switching. false Wait for synchronization (default). -
ShowVirtualKeyboard
<static> ShowVirtualKeyboard ( mode ) -
Show the virtual keyboard on the screen.
User can switch virtual keyboard from english symbols to symbols of the language that is set as the local language in Service Menu.
Parameters:Name Type Argument Default Description mode
boolean
<optional>
false
warm up mode (read all associated files but not showing the VK itself):
Value Description true the keyboard should be warmed up false ignore -
StandBy
<static> StandBy ( mode ) -
Enter or exit StandBy mode.
When entering StandBy mode the following operations take place:
- all video outputs switch off
- content display, if it was on, stops
Parameters:Name Type Description mode
boolean
possible values:
Value Description true enter Standby mode false exit from Standby mode -
StartLocalCfg
<static> StartLocalCfg () -
Start local configuration menu (Service Menu).
Result of this function is similar to pressing "
SET
" ("service
" on old RC) button, if automatic appearance of Service Menu is disabled via gSTB.EnableServiceButton. -
Step
<static> Step () -
Display one next frame of video content.
Platform: MAG100
-
Stop
<static> Stop () -
Stop playing.
gSTB.Continue shall begin playing from the beginning.
-
Version
<static> Version () → {string} -
Get API version.
Returns:Type Description string
the string in the form of:
JS API version: <JS_API>; STB API version: <STB_API>; Player Engine version: <Player>
where:
Value Description JS_API this API version number STB_API player API version Player version of the player used in API in HEX code form Example
// execution result 'JS API version: 301; STB API version: 104; Player Engine version: 0x23'
-
WriteCFG
<static> WriteCFG ( cfg ) -
Write the file of portal settings
/etc/stb_params
.It must be kept in mind that the values PORTAL_IP, PORTAL_1, PORTAL_2 are used in the starting portal stored in
/home/web
of the root file system, therefore it is desirable to receive source values of these parameters via gSTB.ReadCFG before making the call and add them to the string cfg.Parameters:Name Type Description cfg
string
the data to be stored in the file
-
WritePrefs
<static> WritePrefs ( value ) -
Save the string as the browser set up (prefs.js).
This function is not browser specific and it is used to set the right of access to the portal. This is performed in starting portal saved at
/home/web
of the root file system and it is recommended to avoid using it anywhere else.Parameters:Name Type Description value
string
data to be saved in the file of browser settings