AbstractPlayerService


title: AbstractPlayerService

Classes

AbstractPlayerServiceAbstract
AbstractPlayerService

AbstractPlayerService ⇐ Abstract

Kind: global abstract class
Extends: Abstract
Service:
Properties

NameTypeDescription
watchdogTimeoutnumber

Value that defines the number of seconds before setSource will timed out

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

ParamTypeDescription
typeString

The type of player we want (linear, nonlinear)

adActivatedBoolean

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

The playerSession that we want to set a source to

sourceAbstractSource

the source to play

optionsObject

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

The current player session

pause(playerSession) ⇒ undefined

Pause the current media

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

resume(playerSession) ⇒ undefined

Resume the current media

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

getSpeed(playerSession) ⇒ Promise.<Number>

Get the current media playing speed

Kind: instance method of AbstractPlayerService
Returns: Promise.<Number> - The current speed

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

forward(playerSession) ⇒ undefined

Set a forward speed to the media playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

rewind(playerSession) ⇒ undefined

Set a rewind speed to the media playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

seek(playerSession, position) ⇒ undefined

Seek to specific position

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

positionNumber

the seeked position in ms

setAudioTrack(playerSession, audioTrack) ⇒ Promise

Set an audio track on the media currently playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

audioTrackAudioTrack

the audio track to set

getCurrentAudioTrack(playerSession) ⇒ Promise

Returns the audio track currently playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

getAudioTrackList(playerSession) ⇒ Promise

Returns the list of AudioTracks available for the current media

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

mute(playerSession) ⇒ Promise

Mute the player

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

unmute(playerSession) ⇒ Promise

Unmute the player

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

isMuted(playerSession) ⇒ boolean

To know is this player session is muted or not

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

setSubtitle(playerSession, subtitle) ⇒ Promise

Set a subtitle on the media currently playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

subtitleSubtitle

the subtitle to set

setNoSubtitle(playerSession) ⇒ Promise

Play the media without displaying any subtitle

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

getCurrentSubtitle(playerSession) ⇒ Promise

Returns the subtitle currently playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

getSubtitleList(playerSession) ⇒ Promise

Returns the list of subtitles available for the current media

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamType
playerSessionAbstractPlayerSession

_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

ParamTypeDescription
playerSessionAbstractPlayerSession
errorAbstractPlayerError

the player error

setGeometry(playerSession, [geometry], [options]) ⇒ Promise.<T>

Method used to set the player dimensions.

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player setGeometry will apply to

[geometry]Object | null

The player dimension

geometry.widthnumber

The player width (integer)

geometry.heightnumber

The player height (integer)

geometry.leftnumber

The player left position (integer)

geometry.topnumber

The player top position (integer)

geometry.scalenumber

The player scale (integer)

[options]Object

Additional options

options.fullScreenboolean

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

disablePresentation(playerSession) ⇒ Promise

Method used to disable the presentation of player (set invisible and inaudible)

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

isPresentationEnabled(playerSession) ⇒ Promise

To know if presentation is enabled on the player session

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

sourceAbstractSource

The targeted source (which is not yet played but is still valid)

previousSourceAbstractSource

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

sourceAbstractSource

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

errorPlayerSourceChangeError

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

newStatePlayerState

The new state (integer)

oldStatePlayerState

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

positionNumber

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

speedNumber

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

errorAbstractPlayerError

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamType
playerSessionAbstractPlayerSession
newStatePlayerPlayingState

_onAdEvent(playerSession, adEventType) ⇒ Promise

Dispatch ad events

Kind: instance method of AbstractPlayerService

ParamType
playerSessionAbstractPlayerSession
adEventTypeAdEventType

_setSource(playerSession, source;, options;) ⇒ Promise

Implementation of setSource

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session to setSource

source;AbstractSource
options;Object

_release(playerSession) ⇒ Promise

Implementation of release

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_stop(playerSession) ⇒ Promise

Implementation of stop

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getPlayerSession(type, adActivated) ⇒ Promise

Implementation of getPlayerSession

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamType
typeinteger
adActivatedBoolen

_checkPlayerSession(playerSession) ⇒ Promise

Implementation of __checkPlayerSession

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_setGeometry(playerSession, geometry, options) ⇒ Promise

Implementation of setGeometry

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

geometryObject
optionsObject

_enablePresentation(playerSession) ⇒ Promise

Implementation of enablePresentation

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_disablePresentation(playerSession) ⇒ Promise

Implementation of disablePresentation

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_pause(playerSession) ⇒ Promise

Implementation of pause

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_resume(playerSession) ⇒ Promise

Implementation of resume

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getSpeed(playerSession) ⇒ Promise

Implementation of getSpeed

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_forward(playerSession) ⇒ Promise

Implementation of forward

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_rewind(playerSession) ⇒ Promise

Implementation of rewind

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_seek(playerSession) ⇒ Promise

Implementation of seek

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getPosition(playerSession) ⇒ Promise

Implementation of getPosition

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getDuration(playerSession) ⇒ Promise

Implementation of getDuration

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

The current player session

_setAudioTrack(playerSession, audioTrack) ⇒ Promise

Implementation of setAudioTrack

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

audioTrackAudioTrack

_getCurrentAudioTrack(playerSession) ⇒ Promise

Implementation of getCurrentAudioTrack

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getAudioTrackList(playerSession) ⇒ Promise

Implementation of getAudioTrackList

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_mute(playerSession) ⇒ Promise

Implementation of mute

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_unmute(playerSession) ⇒ Promise

Implementation of unmute

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_setSubtitle(playerSession, subtitle) ⇒ Promise

Implementation of setSubtitle

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

subtitleSubtitle

_setNoSubtitle(playerSession) ⇒ Promise

Implementation of setNoSubtitle

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getCurrentSubtitle(playerSession) ⇒ Promise

Implementation of getCurrentSubtitle

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getSubtitleList(playerSession) ⇒ Promise

Implementation of getSubtitleList

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

newStatePlayerState
[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()

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

ParamTypeDescription
typeString

The type of player we want (linear, nonlinear)

adActivatedBoolean

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

The playerSession that we want to set a source to

sourceAbstractSource

the source to play

optionsObject

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

The current player session

pause(playerSession) ⇒ undefined

Pause the current media

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

resume(playerSession) ⇒ undefined

Resume the current media

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

getSpeed(playerSession) ⇒ Promise.<Number>

Get the current media playing speed

Kind: instance method of AbstractPlayerService
Returns: Promise.<Number> - The current speed

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

forward(playerSession) ⇒ undefined

Set a forward speed to the media playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

rewind(playerSession) ⇒ undefined

Set a rewind speed to the media playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

seek(playerSession, position) ⇒ undefined

Seek to specific position

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

positionNumber

the seeked position in ms

setAudioTrack(playerSession, audioTrack) ⇒ Promise

Set an audio track on the media currently playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

audioTrackAudioTrack

the audio track to set

getCurrentAudioTrack(playerSession) ⇒ Promise

Returns the audio track currently playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

getAudioTrackList(playerSession) ⇒ Promise

Returns the list of AudioTracks available for the current media

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

mute(playerSession) ⇒ Promise

Mute the player

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

unmute(playerSession) ⇒ Promise

Unmute the player

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

isMuted(playerSession) ⇒ boolean

To know is this player session is muted or not

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

setSubtitle(playerSession, subtitle) ⇒ Promise

Set a subtitle on the media currently playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

subtitleSubtitle

the subtitle to set

setNoSubtitle(playerSession) ⇒ Promise

Play the media without displaying any subtitle

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

getCurrentSubtitle(playerSession) ⇒ Promise

Returns the subtitle currently playing

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

getSubtitleList(playerSession) ⇒ Promise

Returns the list of subtitles available for the current media

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamType
playerSessionAbstractPlayerSession

_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

ParamTypeDescription
playerSessionAbstractPlayerSession
errorAbstractPlayerError

the player error

setGeometry(playerSession, [geometry], [options]) ⇒ Promise.<T>

Method used to set the player dimensions.

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the player setGeometry will apply to

[geometry]Object | null

The player dimension

geometry.widthnumber

The player width (integer)

geometry.heightnumber

The player height (integer)

geometry.leftnumber

The player left position (integer)

geometry.topnumber

The player top position (integer)

geometry.scalenumber

The player scale (integer)

[options]Object

Additional options

options.fullScreenboolean

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

disablePresentation(playerSession) ⇒ Promise

Method used to disable the presentation of player (set invisible and inaudible)

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession

isPresentationEnabled(playerSession) ⇒ Promise

To know if presentation is enabled on the player session

Kind: instance method of AbstractPlayerService

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

sourceAbstractSource

The targeted source (which is not yet played but is still valid)

previousSourceAbstractSource

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

sourceAbstractSource

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

errorPlayerSourceChangeError

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

newStatePlayerState

The new state (integer)

oldStatePlayerState

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

positionNumber

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

speedNumber

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the playerSession that has its source being changed

errorAbstractPlayerError

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamType
playerSessionAbstractPlayerSession
newStatePlayerPlayingState

_onAdEvent(playerSession, adEventType) ⇒ Promise

Dispatch ad events

Kind: instance method of AbstractPlayerService

ParamType
playerSessionAbstractPlayerSession
adEventTypeAdEventType

_setSource(playerSession, source;, options;) ⇒ Promise

Implementation of setSource

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session to setSource

source;AbstractSource
options;Object

_release(playerSession) ⇒ Promise

Implementation of release

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_stop(playerSession) ⇒ Promise

Implementation of stop

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getPlayerSession(type, adActivated) ⇒ Promise

Implementation of getPlayerSession

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamType
typeinteger
adActivatedBoolen

_checkPlayerSession(playerSession) ⇒ Promise

Implementation of __checkPlayerSession

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_setGeometry(playerSession, geometry, options) ⇒ Promise

Implementation of setGeometry

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

geometryObject
optionsObject

_enablePresentation(playerSession) ⇒ Promise

Implementation of enablePresentation

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_disablePresentation(playerSession) ⇒ Promise

Implementation of disablePresentation

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_pause(playerSession) ⇒ Promise

Implementation of pause

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_resume(playerSession) ⇒ Promise

Implementation of resume

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getSpeed(playerSession) ⇒ Promise

Implementation of getSpeed

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_forward(playerSession) ⇒ Promise

Implementation of forward

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_rewind(playerSession) ⇒ Promise

Implementation of rewind

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_seek(playerSession) ⇒ Promise

Implementation of seek

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getPosition(playerSession) ⇒ Promise

Implementation of getPosition

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getDuration(playerSession) ⇒ Promise

Implementation of getDuration

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

The current player session

_setAudioTrack(playerSession, audioTrack) ⇒ Promise

Implementation of setAudioTrack

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

audioTrackAudioTrack

_getCurrentAudioTrack(playerSession) ⇒ Promise

Implementation of getCurrentAudioTrack

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getAudioTrackList(playerSession) ⇒ Promise

Implementation of getAudioTrackList

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_mute(playerSession) ⇒ Promise

Implementation of mute

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_unmute(playerSession) ⇒ Promise

Implementation of unmute

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_setSubtitle(playerSession, subtitle) ⇒ Promise

Implementation of setSubtitle

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

subtitleSubtitle

_setNoSubtitle(playerSession) ⇒ Promise

Implementation of setNoSubtitle

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getCurrentSubtitle(playerSession) ⇒ Promise

Implementation of getCurrentSubtitle

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

_getSubtitleList(playerSession) ⇒ Promise

Implementation of getSubtitleList

Kind: instance abstract method of AbstractPlayerService
Access: protected

ParamTypeDescription
playerSessionAbstractPlayerSession

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

ParamTypeDescription
playerSessionAbstractPlayerSession

the player session

newStatePlayerState
[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