MediaTrackList

A MediaTrackList lists all available MediaTrack objects that the player can play. It contains MediaTrack objects, which are either AudioTracks or VideoTracks.

Properties

The MediaTrackList object provides the following properties:

Property Type Description
length number The number of media tracks in the list of media tracks.
n: number MediaTrack The MediaTrack object representing the nth text track in the player’s list of audio or video tracks.

Methods

The MediaTrackList object provides the following methods:

Method Arguments Description
addEventListener type : string, listener : EventListener Adds the given listener to the MediaTrackList for the given event type.
item n: number Returns the MediaTrack object representing the nth text track in the player's list of audio or video tracks.
removeEventListener type : string, listener : EventListener Removes the given listener from the MediaTrackList for the given event type.

Events

The MediaTrackList object exposes the following events:

Event Description
addtrack Thrown to indicate that a track has been added to the track list.
change Thrown to indicate that one or more tracks in the track list has switched its state.
removetrack Thrown to indicate that a track has been removed from the track list.

AudioTrack

An AudioTrack object is an element that represents a single audio track that can be played by the player.

Properties

The AudioTrack object provides the following properties:

Property Type Description
activeQuality AudioQuality The quality which is currently being played for this track.
enabled boolean Indicates whether the track is enabled or not.
  • 'true': The track will be enabled. If another track was currently enabled, that track will be disabled and the player will switch to this track.
  • 'false': The track will be disabled. Given that only one track can be active, this means no audio will be played.
id string The unique ID of the given track.
kind string The audio track kind string.
  • 'alternative': A possible alternative to the main track, e.g. a different language
  • 'main': The primary track
label string The track label, if there is one, or the empty string otherwise (indicating that a custom label probably needs to be generated from the other attributes of the object if the object is exposed to the user)
language string The media track language string.
targetQuality AudioQuality or AudioQuality[] The desired Quality or Qualities for this track. Has to be a member of the track object’s list of qualities.
  • One Quality: The player will halt its automatic adaptation algorithm and play the targetQuality.
  • List of Qualities: The player will limit its automatic adaptation algorithm to the provided set of qualities (since v2.18.0).
  • null: The player will continue its automatic adaptation algorithm over all available qualities.
qualities AudioQuality[] An array containing available qualities for this track.

Methods

The AudioTrack object provides the following methods:

Method Arguments Description
addEventListener type : string, listener : EventListener Adds the given listener to the AudioTrack for the given event type.
removeEventListener type : string, listener : EventListener Removes the given listener from the AudioTrack for the given event type.

Events

The AudioTrack object exposes the following events:

Event Description
activequalitychanged Thrown to indicate that a track has changed its active quality.

VideoTrack

A VideoTrack object is an element that represents a single video track that can be played by the player.

Properties

The VideoTrack object provides the following properties:

Property Type Description
activeQuality AudioQuality The quality which is currently being played for this track.
enabled boolean Indicates whether the track is enabled or not.
  • 'true': The track will be enabled. If another track was currently enabled, that track will be disabled and the player will switch to this track.
  • 'false': The track will be disabled. Given that only one track can be active, this means no video will be played.
id string The unique ID of the given track.
kind string The video track kind string.
  • 'alternative': A possible alternative to the main track.
  • 'main': The primary track.
label string The track label, if there is one, or the empty string otherwise (indicating that a custom label probably needs to be generated from the other attributes of the object if the object is exposed to the user)
language string The media track language string.
targetQuality VideoQuality or VideoQuality[] The desired Quality or Qualities for this track. Has to be a member of the track object’s list of qualities.
  • One Quality: The player will halt its automatic adaptation algorithm and play the targetQuality.
  • List of Qualities: The player will limit its automatic adaptation algorithm to the provided set of qualities (since v2.18.0).
  • null: The player will continue its automatic adaptation algorithm over all available qualities.
qualities VideoQuality[] An array containing available qualities for this track.

Methods

The VideoTrack object provides the following methods:

Method Arguments Description
addEventListener type : string, listener : EventListener Adds the given listener to the VideoTrack for the given event type.
removeEventListener type : string, listener : EventListener Removes the given listener from the VideoTrack for the given event type.

 

Events

The VideoTrack object exposes the following events:

Event Description
activequalitychanged Thrown to indicate that a track has changed its active quality.

AudioQuality

An AudioQuality object is an element that represents a single quality for a given AudioTrack that can be played by the player.

Properties

The AudioQuality object provides the following properties:

Property Type Available only if defined by manifest Description
audioSamplingRate number no The audio sampling rate for this quality.
bandwidth number yes The required bandwidth for this quality as defined by the manifest.
codecs string no A string containing the codecs for this quality.
id string no The unique identifier for this quality.
name string yes The name of this quality which could be provided by the manifest.

VideoQuality

A VideoQuality object is an element that represents a single quality for a given VideoTrack that can be played by the player.

Properties

The VideoQuality object provides the following properties:

Property Type Available only if defined by manifest Description
bandwidth number yes The required bandwidth for this quality as defined by the manifest.
codecs string yes A string containing the codecs for this quality as defined by the manifest.
frameRate number yes The framerate for this quality as defined by the manifest.
height number yes The video height for this quality as defined by the manifest.
id string no The unique identifier for this quality.
name string yes The name of this quality which could be provided by the manifest.
width number yes The video width for this quality as defined by the manifest.