AbstractPlayerService
On this page
- title: AbstractPlayerService
- Classes
- AbstractPlayerService ⇐
Abstract
- AbstractPlayerService()
- AbstractPlayerService()
- getPlayerSession(type, adActivated) ⇒
Promise.<AbstractPlayerSession>
- getState(playerSession) ⇒
Promise.<number, Error>
- getPlayingState(playerSession) ⇒
Promise.<number, Error>
- setSource(playerSession, source, options) ⇒
Promise.<AbstractSource, Error>
- getSource(playerSession) ⇒
AbstractSource
- stop(playerSession, [reason]) ⇒
Promise.<boolean>
- release(playerSession) ⇒
Promise.<boolean>
- getPosition(playerSession) ⇒
Promise.<Number>
- getDuration(playerSession) ⇒
Promise.<Number>
- getSeekableTimeRange(playerSession) ⇒
Promise.<TimeRange>
- pause(playerSession) ⇒
undefined
- resume(playerSession) ⇒
undefined
- getSpeed(playerSession) ⇒
Promise.<Number>
- forward(playerSession) ⇒
undefined
- rewind(playerSession) ⇒
undefined
- seek(playerSession, position) ⇒
undefined
- setAudioTrack(playerSession, audioTrack) ⇒
Promise
- getCurrentAudioTrack(playerSession) ⇒
Promise
- getAudioTrackList(playerSession) ⇒
Promise
- mute(playerSession) ⇒
Promise
- unmute(playerSession) ⇒
Promise
- isMuted(playerSession) ⇒
boolean
- setSubtitle(playerSession, subtitle) ⇒
Promise
- setNoSubtitle(playerSession) ⇒
Promise
- getCurrentSubtitle(playerSession) ⇒
Promise
- getSubtitleList(playerSession) ⇒
Promise
- getError(playerSession) ⇒
Promise.<AbstractPlayerError, Error>
- _getError(playerSession) ⇒
Promise.<AbstractPlayerError, null>
- _addError(playerSession, error)
- setGeometry(playerSession, [geometry], [options]) ⇒
Promise.<T>
- enablePresentation(playerSession) ⇒
Promise
- disablePresentation(playerSession) ⇒
Promise
- isPresentationEnabled(playerSession) ⇒
Promise
- _onSourceChangeRequest(playerSession, source, previousSource) ⇒
Promise
- _onSourceChangeSuccess(playerSession, source) ⇒
Promise
- _onSourceChangeError(playerSession, error) ⇒
Promise
- _onStateChanged(playerSession, newState, oldState, [reason]) ⇒
Promise
- _onPlayPositionChange(playerSession, position, [oldPosition]) ⇒
Promise
- _onPlaySpeedChange(playerSession, speed, [oldSpeed]) ⇒
Promise
- _onStreamReady(playerSession) ⇒
Promise
- _onDrmLoadingError(playerSession, error) ⇒
Promise
- _onConnectionRecovered(playerSession) ⇒
Promise
- _onConnectionLost(playerSession) ⇒
Promise
- _onAudioTrackChange(playerSession) ⇒
Promise
- _onVideoTrackChange(playerSession) ⇒
Promise
- _onSubtitleTrackChange(playerSession) ⇒
Promise
- _onPlayingState(playerSession, newState) ⇒
Promise
- _onAdEvent(playerSession, adEventType) ⇒
Promise
- _setSource(playerSession, source;, options;) ⇒
Promise
- _release(playerSession) ⇒
Promise
- _stop(playerSession) ⇒
Promise
- _getPlayerSession(type, adActivated) ⇒
Promise
- _checkPlayerSession(playerSession) ⇒
Promise
- _setGeometry(playerSession, geometry, options) ⇒
Promise
- _enablePresentation(playerSession) ⇒
Promise
- _disablePresentation(playerSession) ⇒
Promise
- _pause(playerSession) ⇒
Promise
- _resume(playerSession) ⇒
Promise
- _getSpeed(playerSession) ⇒
Promise
- _forward(playerSession) ⇒
Promise
- _rewind(playerSession) ⇒
Promise
- _seek(playerSession) ⇒
Promise
- _getPosition(playerSession) ⇒
Promise
- _getDuration(playerSession) ⇒
Promise
- _getSeekableTimeRange(playerSession) ⇒
Promise.<TimeRange>
- _setAudioTrack(playerSession, audioTrack) ⇒
Promise
- _getCurrentAudioTrack(playerSession) ⇒
Promise
- _getAudioTrackList(playerSession) ⇒
Promise
- _mute(playerSession) ⇒
Promise
- _unmute(playerSession) ⇒
Promise
- _setSubtitle(playerSession, subtitle) ⇒
Promise
- _setNoSubtitle(playerSession) ⇒
Promise
- _getCurrentSubtitle(playerSession) ⇒
Promise
- _getSubtitleList(playerSession) ⇒
Promise
- _updateState(playerSession, newState, [reason])
- _getWatchdogPromise() ⇒
Promise.<null, PlayerSourceChangeError>
- AbstractPlayerService
- AbstractPlayerService()
- AbstractPlayerService()
- getPlayerSession(type, adActivated) ⇒
Promise.<AbstractPlayerSession>
- getState(playerSession) ⇒
Promise.<number, Error>
- getPlayingState(playerSession) ⇒
Promise.<number, Error>
- setSource(playerSession, source, options) ⇒
Promise.<AbstractSource, Error>
- getSource(playerSession) ⇒
AbstractSource
- stop(playerSession, [reason]) ⇒
Promise.<boolean>
- release(playerSession) ⇒
Promise.<boolean>
- getPosition(playerSession) ⇒
Promise.<Number>
- getDuration(playerSession) ⇒
Promise.<Number>
- getSeekableTimeRange(playerSession) ⇒
Promise.<TimeRange>
- pause(playerSession) ⇒
undefined
- resume(playerSession) ⇒
undefined
- getSpeed(playerSession) ⇒
Promise.<Number>
- forward(playerSession) ⇒
undefined
- rewind(playerSession) ⇒
undefined
- seek(playerSession, position) ⇒
undefined
- setAudioTrack(playerSession, audioTrack) ⇒
Promise
- getCurrentAudioTrack(playerSession) ⇒
Promise
- getAudioTrackList(playerSession) ⇒
Promise
- mute(playerSession) ⇒
Promise
- unmute(playerSession) ⇒
Promise
- isMuted(playerSession) ⇒
boolean
- setSubtitle(playerSession, subtitle) ⇒
Promise
- setNoSubtitle(playerSession) ⇒
Promise
- getCurrentSubtitle(playerSession) ⇒
Promise
- getSubtitleList(playerSession) ⇒
Promise
- getError(playerSession) ⇒
Promise.<AbstractPlayerError, Error>
- _getError(playerSession) ⇒
Promise.<AbstractPlayerError, null>
- _addError(playerSession, error)
- setGeometry(playerSession, [geometry], [options]) ⇒
Promise.<T>
- enablePresentation(playerSession) ⇒
Promise
- disablePresentation(playerSession) ⇒
Promise
- isPresentationEnabled(playerSession) ⇒
Promise
- _onSourceChangeRequest(playerSession, source, previousSource) ⇒
Promise
- _onSourceChangeSuccess(playerSession, source) ⇒
Promise
- _onSourceChangeError(playerSession, error) ⇒
Promise
- _onStateChanged(playerSession, newState, oldState, [reason]) ⇒
Promise
- _onPlayPositionChange(playerSession, position, [oldPosition]) ⇒
Promise
- _onPlaySpeedChange(playerSession, speed, [oldSpeed]) ⇒
Promise
- _onStreamReady(playerSession) ⇒
Promise
- _onDrmLoadingError(playerSession, error) ⇒
Promise
- _onConnectionRecovered(playerSession) ⇒
Promise
- _onConnectionLost(playerSession) ⇒
Promise
- _onAudioTrackChange(playerSession) ⇒
Promise
- _onVideoTrackChange(playerSession) ⇒
Promise
- _onSubtitleTrackChange(playerSession) ⇒
Promise
- _onPlayingState(playerSession, newState) ⇒
Promise
- _onAdEvent(playerSession, adEventType) ⇒
Promise
- _setSource(playerSession, source;, options;) ⇒
Promise
- _release(playerSession) ⇒
Promise
- _stop(playerSession) ⇒
Promise
- _getPlayerSession(type, adActivated) ⇒
Promise
- _checkPlayerSession(playerSession) ⇒
Promise
- _setGeometry(playerSession, geometry, options) ⇒
Promise
- _enablePresentation(playerSession) ⇒
Promise
- _disablePresentation(playerSession) ⇒
Promise
- _pause(playerSession) ⇒
Promise
- _resume(playerSession) ⇒
Promise
- _getSpeed(playerSession) ⇒
Promise
- _forward(playerSession) ⇒
Promise
- _rewind(playerSession) ⇒
Promise
- _seek(playerSession) ⇒
Promise
- _getPosition(playerSession) ⇒
Promise
- _getDuration(playerSession) ⇒
Promise
- _getSeekableTimeRange(playerSession) ⇒
Promise.<TimeRange>
- _setAudioTrack(playerSession, audioTrack) ⇒
Promise
- _getCurrentAudioTrack(playerSession) ⇒
Promise
- _getAudioTrackList(playerSession) ⇒
Promise
- _mute(playerSession) ⇒
Promise
- _unmute(playerSession) ⇒
Promise
- _setSubtitle(playerSession, subtitle) ⇒
Promise
- _setNoSubtitle(playerSession) ⇒
Promise
- _getCurrentSubtitle(playerSession) ⇒
Promise
- _getSubtitleList(playerSession) ⇒
Promise
- _updateState(playerSession, newState, [reason])
- _getWatchdogPromise() ⇒
Promise.<null, PlayerSourceChangeError>
title: AbstractPlayerService
Classes
- AbstractPlayerService ⇐
Abstract
- AbstractPlayerService
AbstractPlayerService ⇐ Abstract
Kind: global abstract class
Extends: Abstract
Service:
Properties
Name | Type | Description |
---|---|---|
watchdogTimeout | number | Value that defines the number of seconds before setSource will timed out |
- AbstractPlayerService ⇐
Abstract
- new AbstractPlayerService()
- new AbstractPlayerService()
- .getPlayerSession(type, adActivated) ⇒
Promise.<AbstractPlayerSession>
- .getState(playerSession) ⇒
Promise.<number, Error>
- .getPlayingState(playerSession) ⇒
Promise.<number, Error>
- .setSource(playerSession, source, options) ⇒
Promise.<AbstractSource, Error>
- .getSource(playerSession) ⇒
AbstractSource
- .stop(playerSession, [reason]) ⇒
Promise.<boolean>
- .release(playerSession) ⇒
Promise.<boolean>
- .getPosition(playerSession) ⇒
Promise.<Number>
- .getDuration(playerSession) ⇒
Promise.<Number>
- .getSeekableTimeRange(playerSession) ⇒
Promise.<TimeRange>
- .pause(playerSession) ⇒
undefined
- .resume(playerSession) ⇒
undefined
- .getSpeed(playerSession) ⇒
Promise.<Number>
- .forward(playerSession) ⇒
undefined
- .rewind(playerSession) ⇒
undefined
- .seek(playerSession, position) ⇒
undefined
- .setAudioTrack(playerSession, audioTrack) ⇒
Promise
- .getCurrentAudioTrack(playerSession) ⇒
Promise
- .getAudioTrackList(playerSession) ⇒
Promise
- .mute(playerSession) ⇒
Promise
- .unmute(playerSession) ⇒
Promise
- .isMuted(playerSession) ⇒
boolean
- .setSubtitle(playerSession, subtitle) ⇒
Promise
- .setNoSubtitle(playerSession) ⇒
Promise
- .getCurrentSubtitle(playerSession) ⇒
Promise
- .getSubtitleList(playerSession) ⇒
Promise
- .getError(playerSession) ⇒
Promise.<AbstractPlayerError, Error>
- ._getError(playerSession) ⇒
Promise.<AbstractPlayerError, null>
- ._addError(playerSession, error)
- .setGeometry(playerSession, [geometry], [options]) ⇒
Promise.<T>
- .enablePresentation(playerSession) ⇒
Promise
- .disablePresentation(playerSession) ⇒
Promise
- .isPresentationEnabled(playerSession) ⇒
Promise
- ._onSourceChangeRequest(playerSession, source, previousSource) ⇒
Promise
- ._onSourceChangeSuccess(playerSession, source) ⇒
Promise
- ._onSourceChangeError(playerSession, error) ⇒
Promise
- ._onStateChanged(playerSession, newState, oldState, [reason]) ⇒
Promise
- ._onPlayPositionChange(playerSession, position, [oldPosition]) ⇒
Promise
- ._onPlaySpeedChange(playerSession, speed, [oldSpeed]) ⇒
Promise
- ._onStreamReady(playerSession) ⇒
Promise
- ._onDrmLoadingError(playerSession, error) ⇒
Promise
- ._onConnectionRecovered(playerSession) ⇒
Promise
- ._onConnectionLost(playerSession) ⇒
Promise
- ._onAudioTrackChange(playerSession) ⇒
Promise
- ._onVideoTrackChange(playerSession) ⇒
Promise
- ._onSubtitleTrackChange(playerSession) ⇒
Promise
- ._onPlayingState(playerSession, newState) ⇒
Promise
- ._onAdEvent(playerSession, adEventType) ⇒
Promise
- ._setSource(playerSession, source;, options;) ⇒
Promise
- ._release(playerSession) ⇒
Promise
- ._stop(playerSession) ⇒
Promise
- ._getPlayerSession(type, adActivated) ⇒
Promise
- ._checkPlayerSession(playerSession) ⇒
Promise
- ._setGeometry(playerSession, geometry, options) ⇒
Promise
- ._enablePresentation(playerSession) ⇒
Promise
- ._disablePresentation(playerSession) ⇒
Promise
- ._pause(playerSession) ⇒
Promise
- ._resume(playerSession) ⇒
Promise
- ._getSpeed(playerSession) ⇒
Promise
- ._forward(playerSession) ⇒
Promise
- ._rewind(playerSession) ⇒
Promise
- ._seek(playerSession) ⇒
Promise
- ._getPosition(playerSession) ⇒
Promise
- ._getDuration(playerSession) ⇒
Promise
- ._getSeekableTimeRange(playerSession) ⇒
Promise.<TimeRange>
- ._setAudioTrack(playerSession, audioTrack) ⇒
Promise
- ._getCurrentAudioTrack(playerSession) ⇒
Promise
- ._getAudioTrackList(playerSession) ⇒
Promise
- ._mute(playerSession) ⇒
Promise
- ._unmute(playerSession) ⇒
Promise
- ._setSubtitle(playerSession, subtitle) ⇒
Promise
- ._setNoSubtitle(playerSession) ⇒
Promise
- ._getCurrentSubtitle(playerSession) ⇒
Promise
- ._getSubtitleList(playerSession) ⇒
Promise
- ._updateState(playerSession, newState, [reason])
- ._getWatchdogPromise() ⇒
Promise.<null, PlayerSourceChangeError>
AbstractPlayerService()
Using this service, you can create and manage players.
First you need to get a playerSession then you can use it to interact with the player.
AbstractPlayerService()
Main constructor.
getPlayerSession(type, adActivated) ⇒ Promise.<AbstractPlayerSession>
Initalize the video container.
Kind: instance method of AbstractPlayerService
Returns: Promise.<AbstractPlayerSession>
- The current session for this player
Param | Type | Description |
---|---|---|
type | String | The type of player we want (linear, nonlinear) |
adActivated | Boolean | Allow advertissement capabilities on player session (only on session creation) |
getState(playerSession) ⇒ Promise.<number, Error>
Getter which returns the current state of the player.
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession to retrieve the state from |
getPlayingState(playerSession) ⇒ Promise.<number, Error>
Getter which returns the current playing state of the player.
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession to retrieve the state from |
setSource(playerSession, source, options) ⇒ Promise.<AbstractSource, Error>
Setter that starts the setSource process. (You need to have a playerSession already set)
Kind: instance method of AbstractPlayerService
Returns: Promise.<AbstractSource, Error>
- A promised resolved with the zapped source or an error catched if another call has arrived while being zapped
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession that we want to set a source to |
source | AbstractSource | the source to play |
options | Object | Extra values used for the source to be played |
getSource(playerSession) ⇒ AbstractSource
Get current source
Kind: instance method of AbstractPlayerService
Returns: AbstractSource
- the source currently playing
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | playerSession to check source from |
stop(playerSession, [reason]) ⇒ Promise.<boolean>
Method used to stop the player. We check that the session is valid, then if the player is not started we do nothing. Otherwise we stop the player and update its state.
Kind: instance method of AbstractPlayerService
Returns: Promise.<boolean>
- Return a promise resolved to a value set to true if the player has been stopped
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession to stop |
[reason] | number | The reason of the state change (e.g. END_OF_PLAY) |
release(playerSession) ⇒ Promise.<boolean>
Method used to release current source. This stops the player and frees memory. We check that the session is valid, then if the player is already released we do nothing. Otherwise we release the player and update its state.
Kind: instance method of AbstractPlayerService
Returns: Promise.<boolean>
- Return a promise resolved to a value set to true if the player has been released
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession to release |
getPosition(playerSession) ⇒ Promise.<Number>
Return the current media playback position in ms.
Kind: instance method of AbstractPlayerService
Returns: Promise.<Number>
- A Promise resolved with current player’s position in ms
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The current player session |
getDuration(playerSession) ⇒ Promise.<Number>
Return the duration of the current media in ms. Returns Infinity for live and NaN if no media is loaded
Kind: instance method of AbstractPlayerService
Returns: Promise.<Number>
- A Promise resolved with the duration of the stream in ms
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The current player session |
getSeekableTimeRange(playerSession) ⇒ Promise.<TimeRange>
Return the seekable TimeRange
Kind: instance method of AbstractPlayerService
Returns: Promise.<TimeRange>
- A Promise resolved with the TimeRange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The current player session |
pause(playerSession) ⇒ undefined
Pause the current media
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
resume(playerSession) ⇒ undefined
Resume the current media
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
getSpeed(playerSession) ⇒ Promise.<Number>
Get the current media playing speed
Kind: instance method of AbstractPlayerService
Returns: Promise.<Number>
- The current speed
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
forward(playerSession) ⇒ undefined
Set a forward speed to the media playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
rewind(playerSession) ⇒ undefined
Set a rewind speed to the media playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
seek(playerSession, position) ⇒ undefined
Seek to specific position
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
position | Number | the seeked position in ms |
setAudioTrack(playerSession, audioTrack) ⇒ Promise
Set an audio track on the media currently playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
audioTrack | AudioTrack | the audio track to set |
getCurrentAudioTrack(playerSession) ⇒ Promise
Returns the audio track currently playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
getAudioTrackList(playerSession) ⇒ Promise
Returns the list of AudioTracks available for the current media
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
mute(playerSession) ⇒ Promise
Mute the player
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
unmute(playerSession) ⇒ Promise
Unmute the player
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
isMuted(playerSession) ⇒ boolean
To know is this player session is muted or not
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
setSubtitle(playerSession, subtitle) ⇒ Promise
Set a subtitle on the media currently playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
subtitle | Subtitle | the subtitle to set |
setNoSubtitle(playerSession) ⇒ Promise
Play the media without displaying any subtitle
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
getCurrentSubtitle(playerSession) ⇒ Promise
Returns the subtitle currently playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
getSubtitleList(playerSession) ⇒ Promise
Returns the list of subtitles available for the current media
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
getError(playerSession) ⇒ Promise.<AbstractPlayerError, Error>
Return the last error occurred which is the most important one.
Kind: instance method of AbstractPlayerService
Returns: Promise.<AbstractPlayerError, Error>
- A promise resolved with the player error @see AbstractPlayerError
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession we want error from |
_getError(playerSession) ⇒ Promise.<AbstractPlayerError, null>
A default implementation that returns the most important last error (Can be overridden by implementation) Priorities:
- NO_SIGNAL
- ADULT_LOCKED
- PARENTAL_LOCKED
- CHANNEL_LOCKED
- ENCRYPTED
Kind: instance abstract method of AbstractPlayerService
Returns: Promise.<AbstractPlayerError, null>
- A promise resolved with the error that matches the best @see AbstractPlayerError
Access: protected
Param | Type |
---|---|
playerSession | AbstractPlayerSession |
_addError(playerSession, error)
Default implementation to add error to the playerSession’s stack. By default, add the error to the playerSession errors’s map, using the code as the key. (Can be overridden by implementation)
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | |
error | AbstractPlayerError | the player error |
setGeometry(playerSession, [geometry], [options]) ⇒ Promise.<T>
Method used to set the player dimensions.
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player setGeometry will apply to |
[geometry] | Object | null | The player dimension |
geometry.width | number | The player width (integer) |
geometry.height | number | The player height (integer) |
geometry.left | number | The player left position (integer) |
geometry.top | number | The player top position (integer) |
geometry.scale | number | The player scale (integer) |
[options] | Object | Additional options |
options.fullScreen | boolean | If true then just go into fullscreen mode |
enablePresentation(playerSession) ⇒ Promise
Method used to enable the presentation of player (set visible and audible)
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
disablePresentation(playerSession) ⇒ Promise
Method used to disable the presentation of player (set invisible and inaudible)
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
isPresentationEnabled(playerSession) ⇒ Promise
To know if presentation is enabled on the player session
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
_onSourceChangeRequest(playerSession, source, previousSource) ⇒ Promise
Fires a PlayerEvent.sourceChangeRequest event when a request has been made to change the source.
The source is reputed as valid, as defined by checkSource
method. See: AbstractPlayer with inherited function MPlayer#checkSource
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:sourceChangeRequest
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
source | AbstractSource | The targeted source (which is not yet played but is still valid) |
previousSource | AbstractSource | The previousSource |
_onSourceChangeSuccess(playerSession, source) ⇒ Promise
Fires a PlayerEvent.sourceChangeSuccess event when the source has been changed successfully.
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:sourceChangeSuccess
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
source | AbstractSource | The targeted source (which is now played by following the source change) |
_onSourceChangeError(playerSession, error) ⇒ Promise
Fires a PlayerEvent.sourceChangeError event when a source could not be changed, i.e. a fatal error occurs (source does not exists, is invalid, …)
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:sourceChangeError
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
error | PlayerSourceChangeError | the player error |
_onStateChanged(playerSession, newState, oldState, [reason]) ⇒ Promise
Fires a PlayerEvent.stateChanged when a new state has been set.
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:stateChanged
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
newState | PlayerState | The new state (integer) |
oldState | PlayerState | The old state (integer) |
[reason] | number | The reason of the state change (e.g.: END_OF_PLAY) |
_onPlayPositionChange(playerSession, position, [oldPosition]) ⇒ Promise
Fires a PlayerEvent.playPositionChange when the position has changed
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:playPositionChange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
position | Number | the new player position in ms |
[oldPosition] | Number | the previous player position in ms |
_onPlaySpeedChange(playerSession, speed, [oldSpeed]) ⇒ Promise
Fires a PlayerEvent.playSpeedChange when the speed has changed
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:playSpeedChange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
speed | Number | the new speed |
[oldSpeed] | Number | the old speed |
_onStreamReady(playerSession) ⇒ Promise
Fires a PlayerEvent.streamReady event when the stream is ready to play
Kind: instance method of AbstractPlayerService
Emits: PlayerEvent#event:streamReady
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
_onDrmLoadingError(playerSession, error) ⇒ Promise
Fires a PlayerEvent.drmLoadingError event when the DRM workflow has failed
Kind: instance method of AbstractPlayerService
Emits: PlayerEvent#event:drmLoadingError
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
error | AbstractPlayerError | the player error |
_onConnectionRecovered(playerSession) ⇒ Promise
Fires a PlayerEvent.connectionRecovered event when the player has recovered its connection
Kind: instance method of AbstractPlayerService
Emits: PlayerEvent#event:connectionRecovered
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its connection recovered |
_onConnectionLost(playerSession) ⇒ Promise
Fires a PlayerEvent.connectionLost event when the player lost its connection
Kind: instance method of AbstractPlayerService
Emits: PlayerEvent#event:connectionLost
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that got its connection lost |
_onAudioTrackChange(playerSession) ⇒ Promise
Fires a PlayerEvent.audioTrackChange event when the audio track changes.
Kind: instance method of AbstractPlayerService
Emits: AbstractPlayer#event:audioTrackChange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession which audio track has changed |
_onVideoTrackChange(playerSession) ⇒ Promise
Fires a PlayerEvent.videoTrackChange event when the video track changes.
Kind: instance method of AbstractPlayerService
Emits: AbstractPlayer#event:videoTrackChange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession which video track has changed |
_onSubtitleTrackChange(playerSession) ⇒ Promise
Fires a PlayerEvent.subtitleTrackChange event when the subtitle track changes.
Kind: instance method of AbstractPlayerService
Emits: AbstractPlayer#event:subtitleTrackChange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession which subtitle track has changed |
_onPlayingState(playerSession, newState) ⇒ Promise
Dispatch Player’s Playing State (PLAY|PAUSE|FORWARD|REWIND)
Kind: instance method of AbstractPlayerService
Param | Type |
---|---|
playerSession | AbstractPlayerSession |
newState | PlayerPlayingState |
_onAdEvent(playerSession, adEventType) ⇒ Promise
Dispatch ad events
Kind: instance method of AbstractPlayerService
Param | Type |
---|---|
playerSession | AbstractPlayerSession |
adEventType | AdEventType |
_setSource(playerSession, source;, options;) ⇒ Promise
Implementation of setSource
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session to setSource |
source; | AbstractSource | |
options; | Object |
_release(playerSession) ⇒ Promise
Implementation of release
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_stop(playerSession) ⇒ Promise
Implementation of stop
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getPlayerSession(type, adActivated) ⇒ Promise
Implementation of getPlayerSession
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type |
---|---|
type | integer |
adActivated | Boolen |
_checkPlayerSession(playerSession) ⇒ Promise
Implementation of __checkPlayerSession
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_setGeometry(playerSession, geometry, options) ⇒ Promise
Implementation of setGeometry
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
geometry | Object | |
options | Object |
_enablePresentation(playerSession) ⇒ Promise
Implementation of enablePresentation
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_disablePresentation(playerSession) ⇒ Promise
Implementation of disablePresentation
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_pause(playerSession) ⇒ Promise
Implementation of pause
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_resume(playerSession) ⇒ Promise
Implementation of resume
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getSpeed(playerSession) ⇒ Promise
Implementation of getSpeed
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_forward(playerSession) ⇒ Promise
Implementation of forward
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_rewind(playerSession) ⇒ Promise
Implementation of rewind
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_seek(playerSession) ⇒ Promise
Implementation of seek
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getPosition(playerSession) ⇒ Promise
Implementation of getPosition
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getDuration(playerSession) ⇒ Promise
Implementation of getDuration
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getSeekableTimeRange(playerSession) ⇒ Promise.<TimeRange>
Implementation getSeekableTimeRange
Kind: instance abstract method of AbstractPlayerService
Returns: Promise.<TimeRange>
- A Promise resolved with the TimeRange
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The current player session |
_setAudioTrack(playerSession, audioTrack) ⇒ Promise
Implementation of setAudioTrack
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
audioTrack | AudioTrack |
_getCurrentAudioTrack(playerSession) ⇒ Promise
Implementation of getCurrentAudioTrack
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getAudioTrackList(playerSession) ⇒ Promise
Implementation of getAudioTrackList
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_mute(playerSession) ⇒ Promise
Implementation of mute
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_unmute(playerSession) ⇒ Promise
Implementation of unmute
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_setSubtitle(playerSession, subtitle) ⇒ Promise
Implementation of setSubtitle
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
subtitle | Subtitle |
_setNoSubtitle(playerSession) ⇒ Promise
Implementation of setNoSubtitle
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getCurrentSubtitle(playerSession) ⇒ Promise
Implementation of getCurrentSubtitle
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getSubtitleList(playerSession) ⇒ Promise
Implementation of getSubtitleList
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_updateState(playerSession, newState, [reason])
Update the player state that has changed and trigger its stateChanged event handler.
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
newState | PlayerState | |
[reason] | number |
_getWatchdogPromise() ⇒ Promise.<null, PlayerSourceChangeError>
Return the promise to use for the watchdog when setting a source. The generic implementation is a timeout that will reject the promise after a delay. The delay is configurable using the watchdogTimeout property. (Can be overridden by implementation)
Kind: instance abstract method of AbstractPlayerService
Returns: Promise.<null, PlayerSourceChangeError>
- A rejected promise after $watchdogTimeout seconds timed out.
Access: protected
AbstractPlayerService
Kind: global class
- AbstractPlayerService
- new AbstractPlayerService()
- new AbstractPlayerService()
- .getPlayerSession(type, adActivated) ⇒
Promise.<AbstractPlayerSession>
- .getState(playerSession) ⇒
Promise.<number, Error>
- .getPlayingState(playerSession) ⇒
Promise.<number, Error>
- .setSource(playerSession, source, options) ⇒
Promise.<AbstractSource, Error>
- .getSource(playerSession) ⇒
AbstractSource
- .stop(playerSession, [reason]) ⇒
Promise.<boolean>
- .release(playerSession) ⇒
Promise.<boolean>
- .getPosition(playerSession) ⇒
Promise.<Number>
- .getDuration(playerSession) ⇒
Promise.<Number>
- .getSeekableTimeRange(playerSession) ⇒
Promise.<TimeRange>
- .pause(playerSession) ⇒
undefined
- .resume(playerSession) ⇒
undefined
- .getSpeed(playerSession) ⇒
Promise.<Number>
- .forward(playerSession) ⇒
undefined
- .rewind(playerSession) ⇒
undefined
- .seek(playerSession, position) ⇒
undefined
- .setAudioTrack(playerSession, audioTrack) ⇒
Promise
- .getCurrentAudioTrack(playerSession) ⇒
Promise
- .getAudioTrackList(playerSession) ⇒
Promise
- .mute(playerSession) ⇒
Promise
- .unmute(playerSession) ⇒
Promise
- .isMuted(playerSession) ⇒
boolean
- .setSubtitle(playerSession, subtitle) ⇒
Promise
- .setNoSubtitle(playerSession) ⇒
Promise
- .getCurrentSubtitle(playerSession) ⇒
Promise
- .getSubtitleList(playerSession) ⇒
Promise
- .getError(playerSession) ⇒
Promise.<AbstractPlayerError, Error>
- ._getError(playerSession) ⇒
Promise.<AbstractPlayerError, null>
- ._addError(playerSession, error)
- .setGeometry(playerSession, [geometry], [options]) ⇒
Promise.<T>
- .enablePresentation(playerSession) ⇒
Promise
- .disablePresentation(playerSession) ⇒
Promise
- .isPresentationEnabled(playerSession) ⇒
Promise
- ._onSourceChangeRequest(playerSession, source, previousSource) ⇒
Promise
- ._onSourceChangeSuccess(playerSession, source) ⇒
Promise
- ._onSourceChangeError(playerSession, error) ⇒
Promise
- ._onStateChanged(playerSession, newState, oldState, [reason]) ⇒
Promise
- ._onPlayPositionChange(playerSession, position, [oldPosition]) ⇒
Promise
- ._onPlaySpeedChange(playerSession, speed, [oldSpeed]) ⇒
Promise
- ._onStreamReady(playerSession) ⇒
Promise
- ._onDrmLoadingError(playerSession, error) ⇒
Promise
- ._onConnectionRecovered(playerSession) ⇒
Promise
- ._onConnectionLost(playerSession) ⇒
Promise
- ._onAudioTrackChange(playerSession) ⇒
Promise
- ._onVideoTrackChange(playerSession) ⇒
Promise
- ._onSubtitleTrackChange(playerSession) ⇒
Promise
- ._onPlayingState(playerSession, newState) ⇒
Promise
- ._onAdEvent(playerSession, adEventType) ⇒
Promise
- ._setSource(playerSession, source;, options;) ⇒
Promise
- ._release(playerSession) ⇒
Promise
- ._stop(playerSession) ⇒
Promise
- ._getPlayerSession(type, adActivated) ⇒
Promise
- ._checkPlayerSession(playerSession) ⇒
Promise
- ._setGeometry(playerSession, geometry, options) ⇒
Promise
- ._enablePresentation(playerSession) ⇒
Promise
- ._disablePresentation(playerSession) ⇒
Promise
- ._pause(playerSession) ⇒
Promise
- ._resume(playerSession) ⇒
Promise
- ._getSpeed(playerSession) ⇒
Promise
- ._forward(playerSession) ⇒
Promise
- ._rewind(playerSession) ⇒
Promise
- ._seek(playerSession) ⇒
Promise
- ._getPosition(playerSession) ⇒
Promise
- ._getDuration(playerSession) ⇒
Promise
- ._getSeekableTimeRange(playerSession) ⇒
Promise.<TimeRange>
- ._setAudioTrack(playerSession, audioTrack) ⇒
Promise
- ._getCurrentAudioTrack(playerSession) ⇒
Promise
- ._getAudioTrackList(playerSession) ⇒
Promise
- ._mute(playerSession) ⇒
Promise
- ._unmute(playerSession) ⇒
Promise
- ._setSubtitle(playerSession, subtitle) ⇒
Promise
- ._setNoSubtitle(playerSession) ⇒
Promise
- ._getCurrentSubtitle(playerSession) ⇒
Promise
- ._getSubtitleList(playerSession) ⇒
Promise
- ._updateState(playerSession, newState, [reason])
- ._getWatchdogPromise() ⇒
Promise.<null, PlayerSourceChangeError>
AbstractPlayerService()
Using this service, you can create and manage players.
First you need to get a playerSession then you can use it to interact with the player.
AbstractPlayerService()
Main constructor.
getPlayerSession(type, adActivated) ⇒ Promise.<AbstractPlayerSession>
Initalize the video container.
Kind: instance method of AbstractPlayerService
Returns: Promise.<AbstractPlayerSession>
- The current session for this player
Param | Type | Description |
---|---|---|
type | String | The type of player we want (linear, nonlinear) |
adActivated | Boolean | Allow advertissement capabilities on player session (only on session creation) |
getState(playerSession) ⇒ Promise.<number, Error>
Getter which returns the current state of the player.
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession to retrieve the state from |
getPlayingState(playerSession) ⇒ Promise.<number, Error>
Getter which returns the current playing state of the player.
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession to retrieve the state from |
setSource(playerSession, source, options) ⇒ Promise.<AbstractSource, Error>
Setter that starts the setSource process. (You need to have a playerSession already set)
Kind: instance method of AbstractPlayerService
Returns: Promise.<AbstractSource, Error>
- A promised resolved with the zapped source or an error catched if another call has arrived while being zapped
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession that we want to set a source to |
source | AbstractSource | the source to play |
options | Object | Extra values used for the source to be played |
getSource(playerSession) ⇒ AbstractSource
Get current source
Kind: instance method of AbstractPlayerService
Returns: AbstractSource
- the source currently playing
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | playerSession to check source from |
stop(playerSession, [reason]) ⇒ Promise.<boolean>
Method used to stop the player. We check that the session is valid, then if the player is not started we do nothing. Otherwise we stop the player and update its state.
Kind: instance method of AbstractPlayerService
Returns: Promise.<boolean>
- Return a promise resolved to a value set to true if the player has been stopped
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession to stop |
[reason] | number | The reason of the state change (e.g. END_OF_PLAY) |
release(playerSession) ⇒ Promise.<boolean>
Method used to release current source. This stops the player and frees memory. We check that the session is valid, then if the player is already released we do nothing. Otherwise we release the player and update its state.
Kind: instance method of AbstractPlayerService
Returns: Promise.<boolean>
- Return a promise resolved to a value set to true if the player has been released
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession to release |
getPosition(playerSession) ⇒ Promise.<Number>
Return the current media playback position in ms.
Kind: instance method of AbstractPlayerService
Returns: Promise.<Number>
- A Promise resolved with current player’s position in ms
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The current player session |
getDuration(playerSession) ⇒ Promise.<Number>
Return the duration of the current media in ms. Returns Infinity for live and NaN if no media is loaded
Kind: instance method of AbstractPlayerService
Returns: Promise.<Number>
- A Promise resolved with the duration of the stream in ms
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The current player session |
getSeekableTimeRange(playerSession) ⇒ Promise.<TimeRange>
Return the seekable TimeRange
Kind: instance method of AbstractPlayerService
Returns: Promise.<TimeRange>
- A Promise resolved with the TimeRange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The current player session |
pause(playerSession) ⇒ undefined
Pause the current media
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
resume(playerSession) ⇒ undefined
Resume the current media
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
getSpeed(playerSession) ⇒ Promise.<Number>
Get the current media playing speed
Kind: instance method of AbstractPlayerService
Returns: Promise.<Number>
- The current speed
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
forward(playerSession) ⇒ undefined
Set a forward speed to the media playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
rewind(playerSession) ⇒ undefined
Set a rewind speed to the media playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
seek(playerSession, position) ⇒ undefined
Seek to specific position
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
position | Number | the seeked position in ms |
setAudioTrack(playerSession, audioTrack) ⇒ Promise
Set an audio track on the media currently playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
audioTrack | AudioTrack | the audio track to set |
getCurrentAudioTrack(playerSession) ⇒ Promise
Returns the audio track currently playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
getAudioTrackList(playerSession) ⇒ Promise
Returns the list of AudioTracks available for the current media
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
mute(playerSession) ⇒ Promise
Mute the player
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
unmute(playerSession) ⇒ Promise
Unmute the player
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
isMuted(playerSession) ⇒ boolean
To know is this player session is muted or not
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
setSubtitle(playerSession, subtitle) ⇒ Promise
Set a subtitle on the media currently playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
subtitle | Subtitle | the subtitle to set |
setNoSubtitle(playerSession) ⇒ Promise
Play the media without displaying any subtitle
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
getCurrentSubtitle(playerSession) ⇒ Promise
Returns the subtitle currently playing
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
getSubtitleList(playerSession) ⇒ Promise
Returns the list of subtitles available for the current media
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
getError(playerSession) ⇒ Promise.<AbstractPlayerError, Error>
Return the last error occurred which is the most important one.
Kind: instance method of AbstractPlayerService
Returns: Promise.<AbstractPlayerError, Error>
- A promise resolved with the player error @see AbstractPlayerError
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The playerSession we want error from |
_getError(playerSession) ⇒ Promise.<AbstractPlayerError, null>
A default implementation that returns the most important last error (Can be overridden by implementation) Priorities:
- NO_SIGNAL
- ADULT_LOCKED
- PARENTAL_LOCKED
- CHANNEL_LOCKED
- ENCRYPTED
Kind: instance abstract method of AbstractPlayerService
Returns: Promise.<AbstractPlayerError, null>
- A promise resolved with the error that matches the best @see AbstractPlayerError
Access: protected
Param | Type |
---|---|
playerSession | AbstractPlayerSession |
_addError(playerSession, error)
Default implementation to add error to the playerSession’s stack. By default, add the error to the playerSession errors’s map, using the code as the key. (Can be overridden by implementation)
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | |
error | AbstractPlayerError | the player error |
setGeometry(playerSession, [geometry], [options]) ⇒ Promise.<T>
Method used to set the player dimensions.
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player setGeometry will apply to |
[geometry] | Object | null | The player dimension |
geometry.width | number | The player width (integer) |
geometry.height | number | The player height (integer) |
geometry.left | number | The player left position (integer) |
geometry.top | number | The player top position (integer) |
geometry.scale | number | The player scale (integer) |
[options] | Object | Additional options |
options.fullScreen | boolean | If true then just go into fullscreen mode |
enablePresentation(playerSession) ⇒ Promise
Method used to enable the presentation of player (set visible and audible)
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
disablePresentation(playerSession) ⇒ Promise
Method used to disable the presentation of player (set invisible and inaudible)
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
isPresentationEnabled(playerSession) ⇒ Promise
To know if presentation is enabled on the player session
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession |
_onSourceChangeRequest(playerSession, source, previousSource) ⇒ Promise
Fires a PlayerEvent.sourceChangeRequest event when a request has been made to change the source.
The source is reputed as valid, as defined by checkSource
method. See: AbstractPlayer with inherited function MPlayer#checkSource
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:sourceChangeRequest
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
source | AbstractSource | The targeted source (which is not yet played but is still valid) |
previousSource | AbstractSource | The previousSource |
_onSourceChangeSuccess(playerSession, source) ⇒ Promise
Fires a PlayerEvent.sourceChangeSuccess event when the source has been changed successfully.
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:sourceChangeSuccess
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
source | AbstractSource | The targeted source (which is now played by following the source change) |
_onSourceChangeError(playerSession, error) ⇒ Promise
Fires a PlayerEvent.sourceChangeError event when a source could not be changed, i.e. a fatal error occurs (source does not exists, is invalid, …)
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:sourceChangeError
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
error | PlayerSourceChangeError | the player error |
_onStateChanged(playerSession, newState, oldState, [reason]) ⇒ Promise
Fires a PlayerEvent.stateChanged when a new state has been set.
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:stateChanged
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
newState | PlayerState | The new state (integer) |
oldState | PlayerState | The old state (integer) |
[reason] | number | The reason of the state change (e.g.: END_OF_PLAY) |
_onPlayPositionChange(playerSession, position, [oldPosition]) ⇒ Promise
Fires a PlayerEvent.playPositionChange when the position has changed
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:playPositionChange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
position | Number | the new player position in ms |
[oldPosition] | Number | the previous player position in ms |
_onPlaySpeedChange(playerSession, speed, [oldSpeed]) ⇒ Promise
Fires a PlayerEvent.playSpeedChange when the speed has changed
Kind: instance method of AbstractPlayerService
Emits: PlayerService#event:playSpeedChange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
speed | Number | the new speed |
[oldSpeed] | Number | the old speed |
_onStreamReady(playerSession) ⇒ Promise
Fires a PlayerEvent.streamReady event when the stream is ready to play
Kind: instance method of AbstractPlayerService
Emits: PlayerEvent#event:streamReady
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
_onDrmLoadingError(playerSession, error) ⇒ Promise
Fires a PlayerEvent.drmLoadingError event when the DRM workflow has failed
Kind: instance method of AbstractPlayerService
Emits: PlayerEvent#event:drmLoadingError
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its source being changed |
error | AbstractPlayerError | the player error |
_onConnectionRecovered(playerSession) ⇒ Promise
Fires a PlayerEvent.connectionRecovered event when the player has recovered its connection
Kind: instance method of AbstractPlayerService
Emits: PlayerEvent#event:connectionRecovered
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that has its connection recovered |
_onConnectionLost(playerSession) ⇒ Promise
Fires a PlayerEvent.connectionLost event when the player lost its connection
Kind: instance method of AbstractPlayerService
Emits: PlayerEvent#event:connectionLost
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession that got its connection lost |
_onAudioTrackChange(playerSession) ⇒ Promise
Fires a PlayerEvent.audioTrackChange event when the audio track changes.
Kind: instance method of AbstractPlayerService
Emits: AbstractPlayer#event:audioTrackChange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession which audio track has changed |
_onVideoTrackChange(playerSession) ⇒ Promise
Fires a PlayerEvent.videoTrackChange event when the video track changes.
Kind: instance method of AbstractPlayerService
Emits: AbstractPlayer#event:videoTrackChange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession which video track has changed |
_onSubtitleTrackChange(playerSession) ⇒ Promise
Fires a PlayerEvent.subtitleTrackChange event when the subtitle track changes.
Kind: instance method of AbstractPlayerService
Emits: AbstractPlayer#event:subtitleTrackChange
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the playerSession which subtitle track has changed |
_onPlayingState(playerSession, newState) ⇒ Promise
Dispatch Player’s Playing State (PLAY|PAUSE|FORWARD|REWIND)
Kind: instance method of AbstractPlayerService
Param | Type |
---|---|
playerSession | AbstractPlayerSession |
newState | PlayerPlayingState |
_onAdEvent(playerSession, adEventType) ⇒ Promise
Dispatch ad events
Kind: instance method of AbstractPlayerService
Param | Type |
---|---|
playerSession | AbstractPlayerSession |
adEventType | AdEventType |
_setSource(playerSession, source;, options;) ⇒ Promise
Implementation of setSource
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session to setSource |
source; | AbstractSource | |
options; | Object |
_release(playerSession) ⇒ Promise
Implementation of release
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_stop(playerSession) ⇒ Promise
Implementation of stop
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getPlayerSession(type, adActivated) ⇒ Promise
Implementation of getPlayerSession
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type |
---|---|
type | integer |
adActivated | Boolen |
_checkPlayerSession(playerSession) ⇒ Promise
Implementation of __checkPlayerSession
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_setGeometry(playerSession, geometry, options) ⇒ Promise
Implementation of setGeometry
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
geometry | Object | |
options | Object |
_enablePresentation(playerSession) ⇒ Promise
Implementation of enablePresentation
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_disablePresentation(playerSession) ⇒ Promise
Implementation of disablePresentation
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_pause(playerSession) ⇒ Promise
Implementation of pause
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_resume(playerSession) ⇒ Promise
Implementation of resume
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getSpeed(playerSession) ⇒ Promise
Implementation of getSpeed
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_forward(playerSession) ⇒ Promise
Implementation of forward
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_rewind(playerSession) ⇒ Promise
Implementation of rewind
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_seek(playerSession) ⇒ Promise
Implementation of seek
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getPosition(playerSession) ⇒ Promise
Implementation of getPosition
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getDuration(playerSession) ⇒ Promise
Implementation of getDuration
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getSeekableTimeRange(playerSession) ⇒ Promise.<TimeRange>
Implementation getSeekableTimeRange
Kind: instance abstract method of AbstractPlayerService
Returns: Promise.<TimeRange>
- A Promise resolved with the TimeRange
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | The current player session |
_setAudioTrack(playerSession, audioTrack) ⇒ Promise
Implementation of setAudioTrack
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
audioTrack | AudioTrack |
_getCurrentAudioTrack(playerSession) ⇒ Promise
Implementation of getCurrentAudioTrack
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getAudioTrackList(playerSession) ⇒ Promise
Implementation of getAudioTrackList
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_mute(playerSession) ⇒ Promise
Implementation of mute
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_unmute(playerSession) ⇒ Promise
Implementation of unmute
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_setSubtitle(playerSession, subtitle) ⇒ Promise
Implementation of setSubtitle
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
subtitle | Subtitle |
_setNoSubtitle(playerSession) ⇒ Promise
Implementation of setNoSubtitle
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getCurrentSubtitle(playerSession) ⇒ Promise
Implementation of getCurrentSubtitle
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_getSubtitleList(playerSession) ⇒ Promise
Implementation of getSubtitleList
Kind: instance abstract method of AbstractPlayerService
Access: protected
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
_updateState(playerSession, newState, [reason])
Update the player state that has changed and trigger its stateChanged event handler.
Kind: instance method of AbstractPlayerService
Param | Type | Description |
---|---|---|
playerSession | AbstractPlayerSession | the player session |
newState | PlayerState | |
[reason] | number |
_getWatchdogPromise() ⇒ Promise.<null, PlayerSourceChangeError>
Return the promise to use for the watchdog when setting a source. The generic implementation is a timeout that will reject the promise after a delay. The delay is configurable using the watchdogTimeout property. (Can be overridden by implementation)
Kind: instance abstract method of AbstractPlayerService
Returns: Promise.<null, PlayerSourceChangeError>
- A rejected promise after $watchdogTimeout seconds timed out.
Access: protected