- Overview
- Structure of a Manifest Object
- Structure of a Period Object
- Structure of an Adaptation Object
- Structure of a Representation Object
- Structure of a RepresentationIndex Object
- Structure of a Segment Object
A Manifest Object and its sub-parts are data structures returned by multiple APIs of the player.
Its data represents the corresponding streaming protocol's Manifest equivalent (MPD for DASH, Manifest for Microsoft Smooth Streaming etc.).
Basically, the structure of a Manifest file has the following hierarchy:
Manifest Object
...Manifest data and methods
Period Object
...Period properties
Adaptation Object
...Adaptation data and methods
Representation Object
...Representation data and methods
RepresentationIndex Object
...RepresentationIndex data and methods
SegmentObject
...SegmentObject data
Due to this highly hierachical structure, each level will be described in its own chapter here.
Only use the documented variables and open an issue if you think it's not enough.
The manifest Object represents the Manifest file of the content loaded.
The manifest Object has the following properties.
type: Array.<Period>
A single Manifest instance can contain multiple Periods, which are periods of time for which the list of available type of contents (audio tracks, subtitles, video tracks...) can be different.
Such example of Periods could be multiple Programs of a live contents, which can be each in different languages, for example.
The player will switch smoothly across subsequent Periods within playback.
Most Streaming technologies (e.g. HLS and Smooth) do not have a "Period" concept. For those, the Manifest will only have one Period for the whole content.
v4.0.0
(see Deprecated APIs).
type: Object
Adaptation objects for the first Period.
Both of those lines have the same effect:
console.log(manifest.adaptations);
console.log(manifest.periods[0].adaptations);
See the Period chapter for more information on Adaptations.
type: Boolean
true
if the content is a "live" content (e.g. a live TV Channel).
false
otherwise.
type: Array.<string>
The list of uris that can be used to refer to the Manifest file.
type: string
The type of transport used. For now, this can only be equal to either dash
or smooth
.
A Period is an object describing what to play during a certain time periods.
A Manifest can have a single Period, which means that the played content do not change its characteristics (same languages, same bitrates etc.) or multiple ones.
A good example of a content with multiple Periods would be a live channel broadcasting multiple foreign films. Each film, being in a different language, will need to be part of a new Period.
type: string
This id should be a string unique to that Period. It serves identifications purpose, when updating the Manifest for example.
type: Number
Start time at which the Period begins in the whole content, in seconds.
type: Number|undefined
End time at which the Period ends in the whole content, in seconds.
If not set or set to undefined, it means that the end is unknown, in which case it is the current last content of the current Manifest.
type: Object
The Adaptations (tracks if you want) for the current content, per-type (audio/video/text/image).
See the Adaptation chapter for more info about an Adaptation's structure.
The Adaptation object can contain any of the following keys:
- audio (
Array.<Adaptation>
): The audio Adaptation(s) available. - video (
Array.<Adaptation>
): The video Adaptation(s) available. - text (
Array.<Adaptation>
): The text Adaptation(s) available. - image (
Array.<Adaptation>
): The image Adaptation(s) available.
An Adaptation is a set of streams representing the exact same contents in multiple forms (different sizes, different bitrates...). Concretely, a frequent usecase is to have a single video Adaptation and multiple audio ones, one for each language available.
As such, it is also often called in the API a track
.
type: string
This id should be a string unique to that Adaptation. It serves identifications purpose, when updating the Manifest for example.
type: string
The type of the Adaptation. The possible types are:
"video"
"audio"
"text"
"image"
type: string|undefined
The language of the Adaptation. This is particularly useful for audio and text Adaptations.
Note that this property is not always present in an Adaptation.
type: string|undefined
An attempt to translate the language of the Adaptation into an ISO 639-3 code.
If the translation attempt fails (no corresponding ISO 639-3 language code is
found), it will equal the value of language
Note that this property is not always present in an Adaptation.
type: Boolean|undefined
This property only makes sense for audio Adaptations. In this case, if true
it means that the audio track has added commentaries for the visually impaired.
type: Boolean|undefined
This property only makes sense for text Adaptations. In this case, if true
it means that the text track has added hints for the hard of hearing.
type : Boolean|undefined
This property only makes sense for video Adaptations. In this case, if true
it means that the video track is a trick mode track that will be played only
if the user start the trick mode on the respective main adaptation.
type: Array.<Representation>
The Represesentations for this Adaptation.
See the Representation chapter for more info about a Representation's structure.
return value: Array.<Number>
Returns every bitrates available for this Adaptation.
A Representation is an Adaptation encoded in a certain way. It is defined by multiple values (a codec, a bitrate). Only some of them are documented here (as stated before, open an issue if you would like to access other properties).
type: string
This id should be a string unique to that Representation.
type: Number
The bitrate of the Representation.
type: string|undefined
The codec of the Representation.
type: boolean|undefined
Whether we are able to decrypt this Representation / unable to decrypt it or if we don't know yet:
- if
true
, it means that we know we were able to decrypt this Representation in the current content. - if
false
, it means that we know we were unable to decrypt this Representation - if
undefined
there is no certainty on this matter
type: Number|undefined
This property makes the most sense for video Representations. It defines the height of the video, in pixels.
type: Number|undefined
This property makes the most sense for video Representations. It defines the width of the video, in pixels.
type: RepresentationIndex
The represesentation index for this Representation.
See the RepresentationIndex chapter for more info about a RepresentationIndex's structure.
type: string|undefined
The represesentation frame rate for this Representation. It defines either the number of frames per second as an integer (24), or as a ratio (24000 / 1000).
type: Object|undefined
Information about the hdr characteristics of the track. (see HDR support documentation)
A RepresentationIndex is an uniform way of declaring the segment index in any Manifest.
That's the part that calculates which segments will be needed. Because the index can be different depending on the type of contents/transport most interactions here are done through few methods which hide the complexity underneath.
arguments:
-
up (
Number
): The position, in seconds from which you want to get the segment. -
duration (
Number
): The duration in seconds from the asked position
return value: Array.<Segment>
Returns the needed segments as defined by the current Manifest during an asked timeframe.
See the Segment chapter for more info about a Segment's structure.
A Segment object defines a segment, as generated by the RepresentationIndex.
Those segments can have multiple useful properties which for the most part are described here.
type: string
This id should be a string unique to that segment.
type: Number
The timescale in which the duration and time are expressed.
Basically, divide any of those by the timescale to obtain seconds.
type: Number|undefined
The duration, timescaled, of the Segments in s.
type: Number
The start time, timescaled, of the Segments in s.
type: Boolean|undefined
If true, the segment concerned is an init segment.
type: Array.<Number>|null|undefined
If defined, it means that the segment is defined in a certain byte range remotely. In this case, the array contains two elements, the start byte and the end byte.
type: Array.<Number>|null|undefined
If defined, it means that a segment index is defined in a certain byte range remotely. In this case, the array contains two elements, the start byte and the end byte.
type: Number|undefined
The number of the segment (if numbered), useful with certain types of index.