stbPlayerManager

stbPlayerManager

Tutorials:

stbPlayerManager provides API to work with multiple player instances.

Members

(static, readonly) list :Array.<stbPlayer>

Get array of all available stbPlayer instances in the system.

Type:
Examples
// get player #0 instance
// and play some vide content
stbPlayerManager.list[0].play({...});
// is equivalent to legacy call
gSTB.Play(...);
// play video in another player
stbPlayerManager.list[1].play({
    uri: '...',
    position: 10
});

(static, readonly) externalProtocols :Array.<string>

See:

Get a list of loaded external protocol plugins.

Type:
  • Array.<string>
Example
// execution result
[
    'TimeShift',
    'TimeShiftPlayer',
    'BDDVD'
]

(static, readonly) autoFrameRate :stbPlayerManager~frameRateConfig

See:

Get current auto frame rate mode
that controls automatic switching frame rate mode of HDMI video output according to a content frame rate.

Type:

(static, readonly) RTSP :stbPlayerManager~RTSPConfig

Get RTSP configuration.

Type:

Methods

(static) reset()

Restore the default players state.

(static) swap(player1, player2) → {boolean}

Switch two given players.
Affects geometry, sound, teletext and subtitles output.
Works only in case valid stbPlayer instances are provided.

Example
var p0 = stbPlayerManager.list[0],
    p1 = stbPlayerManager.list[1];

// these two calls are equivalent
stbPlayerManager.swap(p0, p1);
stbPlayerManager.swap(p1, p0);
Parameters:
Name Type Description
player1 stbPlayer

first player instance to swap

player2 stbPlayer

second player instance to swap

Returns:

operation status

Type
boolean

(static) setAutoFrameRate(config) → {boolean}

See:

Apply options 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)
and 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.

Example
// enable switching to frame rates 24,50 and 60
stbPlayerManager.setAutoFrameRate({
    fr24: true,
    fr50: true,
    fr60: true
});

// disable auto frame rate switching
stbPlayerManager.setAutoFrameRate({
    fr24: false,
    fr50: false,
    fr60: false
});
Parameters:
Name Type Description
config stbPlayerManager~frameRateConfig

parameters to set

Returns:

operation status

Type
boolean

(static) activateCAS() → {boolean}

Tutorials:

Activate CAS with provided options.
stbPlayerManager.setCASParams should be called beforehand.

Example
// set config options
stbPlayerManager.setCASParams({ ... });

// activate
if ( !stbPlayerManager.activateCAS() ) {
    console.log('CAS is not activated!');
}
Returns:

operation status

Type
boolean

(static) setCASParams(params) → {boolean}

Tutorials:

Set CAS server parameters.

Call of the function can be done many times but becomes effective only if made before stbPlayerManager.activateCAS.

Example
// set primary config options
stbPlayerManager.setCASParams({
    type: 1,
    serverAddress: 'some_server',
    serverPort: 9999
});

// set additional config options
// can be merged with the first setCASParams call
stbPlayerManager.setCASParams({
    errorLevel: 1,
    softDescrambling: true,
    additionalParameter1: 'value1',
    additionalParameter2: 'value2'
});

// activate CAS with provided options
stbPlayerManager.activateCAS();
Parameters:
Name Type Description
params Object

CAS parameters to set

There is a set of predefined properties and it's also possible to specify some additional parameters.

Properties
Name Type Attributes Default Description
type number

mandatory Conditional Access System type

Should be set once after browser start. Possible type values:

Value Description
0 not set
1 Verimatrix
2 SecureMedia
4-10 custom CAS plugin with corresponding number
serverAddress string

CAS server address

serverPort number

CAS server port

companyName string

name of the company under which this operator is registered on CAS server

operatorId number

operator identifier used by STB (if operator ID 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)

iniFile string

address of the settings file in the root file system

See instruction on adjusting CAS Verimatrix in the supplement.

softDescrambling boolean <optional>
true

hard or soft mode of descrambling

At present the use of this property is reasonable 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.

Returns:

operation status

Type
boolean

(static) activateWebCAS() → {boolean}

Activate Web CAS with provided options.
stbPlayerManager.setWebCASParams should be called beforehand.

Example
// set config options
stbPlayerManager.setWebCASParams({ ... });

// activate
if ( !stbPlayerManager.activateWebCAS() ) {
    console.log('Web CAS is not activated!');
}
Returns:

operation status

Type
boolean

(static) setWebCASParams(params) → {boolean}

Set Web CAS server parameters.

Call of the function can be done many times but becomes effective only if made before stbPlayerManager.activateWebCAS.

Parameters:
Name Type Description
params Object

Web CAS parameters to set

Properties
Name Type Attributes Description
serverAddress string

Web CAS server address (e.g. "verimatrix.com")

companyName string <optional>

name of the company under which this operator is registered on CAS server

logging boolean

enable/disable logging to file (turned off by default)

File /ram/data/vrweb_client.log is used to store log data.
It's possible to read it with gSTB.RDir('tempfile read vrweb_client.log').

Returns:

operation status

Type
boolean

(static) setRTSP(config) → {boolean}

Set client to STB.

Parameters:
Name Type Description
config stbPlayerManager~RTSPConfig

RTSP configuration options

Returns:

operation status

Type
boolean

(static) setBufferSize(sizeInMs, sizeInBytes) → {boolean}

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)

Buffer is filled until one of the parameters would be reached.

Parameters:
Name Type Description
sizeInMs number

maximum buffer size in milliseconds

sizeInBytes number

maximum buffer size in bytes (15000000 on most devices at the moment)

used ONLY to limit maximum amount of allocated memory but not as the primary buffer size

Returns:

operation status

Type
boolean

Type Definitions

frameRateConfig

See:
Properties:
Name Type Description
fr24 boolean

can switch to 1080p-24 mode

fr50 boolean

can switch to 720p-50, 1080i-50, 1080p-50 modes

fr60 boolean

can switch to 720p-60, 1080i-60, 1080p-60 modes

Player auto frame rate structure.

Type:
  • Object

RTSPConfig

See:
Properties:
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
7 Elecard RTSP server
keepAlive boolean

switch on the keep-alive mode

endByAnnounce boolean

determination of the stream end by the field x-notice in the message ANNOUNCE from the server

endByGetParameter boolean

determination of te stream end by the field x-notice in the answer to GET_PARAMETER

endByTimeout boolean

determination of the stream end after a period of time of the video stream from the server absence

endByRTP boolean

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)

useUDP boolean

use UDP transport to send video

useRTPOverRTSP boolean

use RTP transport over RTSP connection

updateDuration boolean

update media duration on every GetMediaLen call

nonSmoothPause boolean

use non smooth exit from pause since server streaming leads to overflow

Player RTSP config structure.

Type:
  • Object