Class: MediaComposition

MediaComposition()

new MediaComposition()

Source:

Methods

(static) findDrmListByResource(resource) → {Array}

Find a drm by resource

Parameters:
Name Type Description
resource Resource
Source:
Returns:

of drm

Type
Array

(static) orderMainResourcesByQuality(resourcesToOrder, quality,) → {Array}

Order the resources by a preferred quality FYI: The [...resourcesToOrder] avoid to mutate the parameter with the sort method

Parameters:
Name Type Description
resourcesToOrder Array

array to order

quality, String

the default preferred quality is HD

Source:
See:
  • SRGQuality all available qualities
Returns:

resources ordered by a preferred quality

Type
Array

(static) orderMainResourcesByStreamType(resourcesToOrder, streamType,) → {Array}

Order the stream types by a preferred type FYI: The [...resourcesToOrder] avoid to mutate the parameter with the sort method

Parameters:
Name Type Description
resourcesToOrder Array

array to order

streamType, String

the default preferred stream type is DVR

Source:
See:
  • SRGStreamType all available stream types
Returns:

resources ordered by a preferred stream type

Type
Array

filterMainResourcesByQuality(quality) → {Array}

Filter the main resource by quality

Parameters:
Name Type Description
quality String

is set to HD by default

Source:
Returns:

filtered resources by quality

Type
Array

findChapterByUrn(urn) → {Object}

Find a chapter by his URN

Parameters:
Name Type Description
urn String
Source:
Returns:

chapter

Type
Object

findMainSegment() → {undefined|*}

Return segment from main chapter following segmentUrn in mediaComposition.

Source:
Returns:
Type
undefined | *

findResourceListByUrn(urn) → {Array|undefined}

Find resource list by URN

Parameters:
Name Type Description
urn String
Source:
Returns:

of resources

Type
Array | undefined

getChapters() → {Array}

Chapters as provided by the server

Source:
Returns:

of chapters

Type
Array

getFilteredExternalSubtitles(logger) → {Array}

Filter external text tracks that are already available internally.

Rules:

  1. TTML format is filtered

  2. If both are empty that means only internal text tracks will be displayed to the user as they are automatically loaded by the player.

  3. If subtitleInformationList is missing from the MediaComposition and subtitleList is available but the media contains internal text tracks that are also available internaly. It will result on a duplication client side.

  4. If subtitleList and subtitleInformationList a merge between both will be operated, removing the external text tracks already available internaly.

Parameters:
Name Type Description
logger Object
Source:
Returns:

external text tracks

Type
Array

getMainBlockReason() → {undefined|String}

Block reason for main chapter. This also uses current date for STARTDATE.

Source:
See:
  • BlockingReason
Returns:

undefined if main chapter is not blocked

Type
undefined | String

getMainChapter()

Get the mediaComposition's main chapter

Source:

getMainChapterImageUrl() → {String|undefined}

Get the main chapter's image URL decorated with default width and format.

Source:
Returns:

image URL.

Type
String | undefined

getMainResources(preferredQuality, preferredStreamType) → {Array}

Get videojs formatted main resources

Parameters:
Name Type Description
preferredQuality String

set the preferred quality SD, HD, HQ

preferredStreamType String

set the preferred stream type ON_DEMAND, LIVE, DVR

Source:
See:
  • SRGQuality all available qualities
  • SRGStreamType all available stream types
Returns:

array of sources

Type
Array

getMainSegments() → {Array}

Get segments of the main chapter ordered by markIn

Source:
Returns:

of segments

Type
Array

getMainValidFromDate() → {Date}

Compute a date from which this content is valid. Always return a date object.

Source:
Returns:

date specified in media composition or EPOCH when no date present.

Type
Date

getMergedAnalyticsData() → {Object}

Get merged analytics data

Source:
Returns:
Type
Object

getMergedAnalyticsMetadata() → {Object}

Get merged analytics metadata

Source:
Returns:
Type
Object

getResourceList() → {Array}

Get the chapter's resource list

Source:
Returns:

of resources

Type
Array

getSubdivisions() → {Array}

Get subdivisions to be displayed for this MediaComposition. They can be segments or chapters.

Source:
Returns:

of subdivisions

Type
Array