Interface TextTrack

Represents a text track of a media resource.

interface TextTrack {
    accessibility: AccessibilityRole[];
    activeCues: null | TextTrackCueList;
    cues: null | TextTrackCueList;
    forced: boolean;
    id: string;
    inBandMetadataTrackDispatchType: string;
    kind: string;
    label: string;
    language: string;
    mode: string;
    readyState: TextTrackReadyState;
    src: string;
    type: TextTrackType;
    uid: number;
    addEventListener<TType>(type: TType | readonly TType[], listener: EventListener<TextTrackEventMap[TType]>): void;
    removeEventListener<TType>(type: TType | readonly TType[], listener: EventListener<TextTrackEventMap[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.

activeCues: null | TextTrackCueList

The list of active cues of the track.


- A cue is active if the current playback position falls within the time bounds of the cue.
- This list dynamically updates based on the current playback position.
- If the TextTrack.mode is 'disabled', this property is null.

cues: null | TextTrackCueList

The list of cues of the track.


- If the TextTrack.mode is 'disabled', this property is null.

forced: boolean

Indicates whether the track contains Forced Narrative cues. This may only be true for subtitle tracks where
- For DASH: the corresponding AdaptationSet contains a child Role with its value attribute equal to 'forced_subtitle'
- For HLS: the corresponding #EXT-X-MEDIA tag contains the attributes TYPE=SUBTITLES and FORCED=YES (not supported yet)

id: string

The identifier of the text track.


- This identifier can be used to distinguish between related tracks, e.g. tracks in the same list.
- For a text track embedded within an MPEG-DASH stream, this returns the Representation’d id attribute.
- For MPEG-DASH streams a Representation's ID is preferred over the AdaptationSet's ID.

inBandMetadataTrackDispatchType: string

The in-band metadata track dispatch type of the text track.

kind: string

The kind of the text track, represented by a value from the following list:
- 'subtitles': The track contains subtitles.
- 'captions': The track contains closed captions, a translation of dialogue and sound effects.
- 'descriptions': The track contains descriptions, a textual description of the video.
- 'chapters': The track contains chapter titles.
- 'metadata': The track contains metadata. This track will not serve display purposes.

label: string

The label of the text track.

language: string

The language of the text track.

mode: string

The mode of the text track, represented by a value from the following list:
- 'disabled': The track is disabled.
- 'hidden': The track is hidden.
- 'showing': The track is showing.


- A disabled track is not displayed and exposes no active cues, nor fires cue events.
- A hidden track is not displayed but exposes active cues and fires cue events.
- A showing track is displayed, exposes active cues and fires cue events.

The ready state of the text track.

src: string

The source of the text track.

The content type of the text track.

uid: number

A unique identifier of the text 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