SrgSsr

new SrgSsr()

Methods

(static) addBlockedSegments(player, segmentsopt)

Adds blocked segments to the player.

Parameters:
NameTypeAttributesDefaultDescription
playermodule:video.js/dist/types/player~default
segmentsArray.<Segment><optional>
[]

(static) addChapters(player, chapterUrn, chaptersopt)

Adds chapters to the player.

Parameters:
NameTypeAttributesDefaultDescription
playermodule:video.js/dist/types/player~default
chapterUrnstring

The URN of the main chapter.

chaptersArray.<Chapter><optional>
[]

(static) addIntervals(player, intervalsopt)

Adds intervals to the player.

Parameters:
NameTypeAttributesDefaultDescription
playermodule:video.js/dist/types/player~default
intervalsArray.<TimeInterval><optional>
[]

(static) addRemoteTextTracks(player, subtitlesopt)

Adds remote text tracks from an array of subtitles.

Parameters:
NameTypeAttributesDefaultDescription
playermodule:video.js/dist/types/player~default
subtitlesArray.<Subtitle><optional>
[]

(static) addTextTrackCue(textTrack, data)

Add a new cue to a text track with the given data.

Parameters:
NameTypeDescription
textTrackTextTrack
dataSegment | Chapter | TimeInterval

SRG SSR's cue-like representation

(static) addTextTracks(player, srcMediaObj)

Add multiple text tracks to the player.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
srcMediaObjComposedSrcMediaData

(static) blockingReason(player, srcMediaObj) → {undefined|Boolean}

Set a blocking reason according to the block reason returned by mediaData.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
srcMediaObjComposedSrcMediaData
Returns:
Type: 
undefined | Boolean

(async, static) composeAkamaiResources(resources) → {Promise.<Array.<MainResourceWithKeySystems>>}

Add the Akamai token to all resources if at least one of them has tokenType set to Akamai.

Parameters:
NameTypeDescription
resourcesArray.<MainResourceWithKeySystems>
Returns:
Type: 
Promise.<Array.<MainResourceWithKeySystems>>

(static) composeKeySystemsResources(resources) → {Array.<MainResourceWithKeySystems>}

Add the keySystems property to all resources if at least one of them has DRM.

Parameters:
NameTypeDescription
resourcesArray.<MainResource>
Returns:
Type: 
Array.<MainResourceWithKeySystems>

(static) composeMainResources(mediaComposition) → {Promise.<Array.<MainResourceWithKeySystems>>}

Get the main resources from a mediaComposition. May add an Akamai token or key systems if required by the resource.

Parameters:
NameTypeDescription
mediaCompositionMediaComposition
Returns:
Type: 
Promise.<Array.<MainResourceWithKeySystems>>

(static) composeSrcMediaData(srcObj, resource) → {ComposedSrcMediaData}

Compose source options with media data. MediaData properties from source options overwrite mediaData from IL.

Parameters:
NameTypeDescription
srcObjany
Properties
NameTypeDescription
mediaDataany

overrides or adds metadata to the composed mediaData.

disableTrackersboolean
resourceMainResourceWithKeySystems
Returns:
Type: 
ComposedSrcMediaData

(static) createTextTrack(player, trackId) → {Promise.<TextTrack>}

Create a new metadata text track.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
trackIdString

Text track unique ID

Returns:
Type: 
Promise.<TextTrack>

(static) cuechangeEventProxy(player)

Proxy SRG SSR chapters and intervals cuechange events at player level.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default

(static) dataProvider(player) → {DataProvider}

SRG SSR data provider singleton.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
Returns:
Type: 
DataProvider

(static) dataProviderError(player, error) → {undefined|true}

Set an error if something goes wrong with the data provider.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
errorObject
Returns:
Type: 
undefined | true

(static) error(player, error)

Set player error.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
errorObject

(static) filterIncompatibleResources(resources) → {Array.<MainResource>}

Filter out incompatible resources such as RTMP and HDS.

Parameters:
NameTypeDescription
resourcesArray.<MainResource>

Resources to filter

Returns:

The filtered resources

Type: 
Array.<MainResource>

(static) getBlockedSegment(player) → {VTTCue|undefined}

Get the current blocked segment from the player.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
Returns:

The blocked segment cue object, or undefined

Type: 
VTTCue | undefined

(static) getBlockedSegmentByTime(player, currentTime) → {VTTCue|undefined}

Get the VTT cue of a blocked segment.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
currentTimeNumber
Returns:

The VTT cue of a blocked segment, or undefined

Type: 
VTTCue | undefined

(async, static) getMediaComposition(urn, requestHandler) → {Promise.<MediaComposition>}

Get mediaComposition from an URN.

Parameters:
NameTypeDescription
urnString
requestHandlerfunction
Returns:
Type: 
Promise.<MediaComposition>

(static) getMediaData(resources) → {MainResourceWithKeySystems}

Get the mediaData most likely to be compatible depending on the browser.

Parameters:
NameTypeDescription
resourcesArray.<MainResourceWithKeySystems>
Returns:

By default, the first entry is used if none is compatible.

Type: 
MainResourceWithKeySystems

(async, static) getSrcMediaObj(player, srcObj) → {Promise.<ComposedSrcMediaData>}

Get the source media object.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
srcObjany
Returns:
  • The composed source media data.
Type: 
Promise.<ComposedSrcMediaData>

(static) handleCurrentTime(player, currentTime) → {number}

Handles the middleware's currentTime function.

  • If the current time is between the start and end of a blocked segment, the blocked portion will be skipped.

Note: This function should disappear as soon as this behavior is supported on the packaging side.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
currentTimenumber
Returns:
Type: 
number

(static) handleSetCurrentTime(player, currentTime) → {number}

Handles the middleware's setCurrentTime function.

  • Modify the current time if the value is between the start and end of a blocked segment.

Note: This function should disappear as soon as this behavior is supported on the packaging side.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
currentTimenumber
Returns:
Type: 
number

(async, static) handleSetSource(player, srcObj, next) → {Promise.<any>}

Handles the middleware's setSource function.

This function allows to:

  • resolve a URN into media that can be played by the player
  • initialize media playback tracking
  • update the title bar
  • handle blocking reasons
  • add remote subtitles
Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
srcObjany
nextfunction
Returns:
Type: 
Promise.<any>

(static) middleware(player) → {Object}

Middleware to resolve SRG SSR URNs into playable media.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
Returns:
Type: 
Object

(static) pillarboxMonitoring(player) → {PillarboxMonitoring}

PillarboxMonitoring monitoring singleton.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
Returns:

instance of PillarboxMonitoring

Type: 
PillarboxMonitoring

(static) srgAnalytics(player)

SRG SSR analytics singleton.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default

(static) updatePoster(player, srcMediaObj, imageService)

Update player's poster.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
srcMediaObjComposedSrcMediaData
imageServiceImage

(static) updateTitleBar(player, srcMediaObj)

Update player titleBar with title and description.

Parameters:
NameTypeDescription
playermodule:video.js/dist/types/player~default
srcMediaObjComposedSrcMediaData