- 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:
- Array.<stbPlayer>
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>
Get a list of loaded external protocol plugins.
Type:
- Array.<string>
Example
// execution result
[
'TimeShift',
'TimeShiftPlayer',
'BDDVD'
]
(static, readonly) autoFrameRate :stbPlayerManager~frameRateConfig
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}
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
|
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
|
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
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
Properties:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
type |
number | supported RTSP-server types:
|
||||||||||||||||||
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