Interface MediaTrack

Represents a media track (audio or video) of a media resource.

interface MediaTrack {
    accessibility: AccessibilityRole[];
    activeQuality: undefined | Quality;
    enabled: boolean;
    id: string;
    kind: string;
    label: string;
    language: string;
    qualities: QualityList;
    targetQuality: undefined | Quality | Quality[];
    uid: number;
    addEventListener<TType>(type: TType | readonly TType[], listener: EventListener<MediaTrackEventMap[TType]>): void;
    removeEventListener<TType>(type: TType | readonly TType[], listener: EventListener<MediaTrackEventMap[TType]>): void;
}

Hierarchy (view full)

Properties

accessibility: AccessibilityRole[]

The accessibility settings of the track.


- For DASH: the accessibility descriptors for the corresponding AdaptationSet.
- For HLS: the CHARACTERISTICS for the corresponding #EXT-X-MEDIA tag.

activeQuality: undefined | Quality

The active quality of the media track, i.e. the quality that is currently being played.

enabled: boolean

Whether the track is enabled.


- Only one track of the same type (e.g. video) can be enabled at the same time.
- Enabling a track will disable all other tracks of the same type.
- Disabling a track will not enable a different track of the same type.

id: string

The identifier of the media track.


- This identifier can be used to distinguish between related tracks, e.g. tracks in the same list.

kind: string

The kind of the media track, represented by a value from the following list:
- 'main': The track is the default track for playback
- 'alternative': The track is not the default track for playback

label: string

The label of the media track.

language: string

The language of the media track.

qualities: QualityList

The qualities of the media track.

targetQuality: undefined | Quality | Quality[]

One or more desired qualities of the media track.


- If desired qualities are present, the Adaptive Bitrate mechanism of the player will limit itself to these qualities.
- If one desired quality is present, the Adaptive Bitrate mechanism of the player will be disabled and the desired quality will be played back.

uid: number

A unique identifier of the media track.


- This identifier is unique across tracks of a THEOplayer instance and can be used to distinguish between tracks.
- This identifier is a randomly generated number.

Methods