MediaComposition

new MediaComposition()

Represents the composition of media content.

Properties
NameTypeDescription
chapterUrnstring

URN (Uniform Resource Name) of the associated chapter.

segmentUrnstring

URN of the associated segment.

episodeEpisode

Associated episode.

showShow

Associated show.

channelChannel

Associated channel.

chapterListArray.<Chapter>

List of associated chapters.

topicListArray.<Topic>

List of associated topics.

analyticsDataObject.<String, String>

Analytics data associated with the media composition.

analyticsMetadataObject.<String, String>

Metadata associated with analytics for the media composition.

Methods

findChapterByUrn(urn) → {Chapter}

Find a chapter by its URN.

Parameters:
NameTypeDescription
urnString
Returns:

chapter

Type: 
Chapter

findMainSegment() → {Segment|undefined}

Return a segment from main chapter following segmentUrn in mediaComposition.

Returns:

main segment

Type: 
Segment | undefined

findResourceListByUrn(urn) → {Array.<Resource>|undefined}

Find resource list by URN.

Parameters:
NameTypeDescription
urnString
Returns:

of resources

Type: 
Array.<Resource> | undefined

getChapters() → {Array.<Chapter>}

A list of chapters.

Returns:

of chapters

Type: 
Array.<Chapter>

getFilteredExternalSubtitles() → {Array.<Subtitle>}

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 internally. 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 internally.

Returns:

external text tracks

Type: 
Array.<Subtitle>

getMainBlockReason() → {string|undefined}

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

Returns:

undefined if main chapter is not blocked

Type: 
string | undefined

getMainBlockedSegments() → {Array.<Segment>}

Get blocked segments from the main chapter.

Returns:

of blocked segments

Type: 
Array.<Segment>

getMainChapter() → {Chapter}

Get the mediaComposition's main chapter.

Returns:
Type: 
Chapter

getMainChapterImageUrl() → {String|undefined}

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

Returns:

image URL

Type: 
String | undefined

getMainResources() → {Array.<MainResource>}

Get main resources.

Returns:

array of sources.

Type: 
Array.<MainResource>

getMainSegments() → {Array.<Segment>}

Get segments of the main chapter ordered by markIn.

Returns:

of segments

Type: 
Array.<Segment>

getMainTimeIntervals() → {Array.<TimeInterval>}

Retrieves an array of time intervals associated with the main chapter.

Returns:

An array of time intervals.

Type: 
Array.<TimeInterval>

getMainValidFromDate() → {Date}

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

Returns:

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

Type: 
Date

getMergedAnalyticsData(analyticsData) → {Object.<string, string>}

Get merged analytics data.

Parameters:
NameTypeDescription
analyticsDataObject.<string, string>
Returns:

Merged analytics data.

Type: 
Object.<string, string>

getMergedAnalyticsMetadata(analyticsMetadata) → {Object.<string, string>}

Get merged analytics metadata.

Parameters:
NameTypeDescription
analyticsMetadataObject.<string, string>
Returns:

Merged analytics metadata.

Type: 
Object.<string, string>

getResourceList() → {Array.<Resource>}

Get the chapter's resource list

Returns:

of resources

Type: 
Array.<Resource>