THEOplayer > TextTrack
Inherits from Track, EventDispatcher<TextTrackEventMap> . See parent page for inherited properties and methods.
Represents a text track of a media resource.
Signature:
export interface TextTrack extends Track, EventDispatcher<TextTrackEventMap>
Property |
Type |
Description |
---|---|---|
TextTrackCueList |
The list of active cues of the track. |
|
TextTrackCueList |
The list of cues of the track. |
|
|
Indicates whether the track contains Forced Narrative cues. This may only be true for subtitle tracks where |
|
|
The identifier of the text track. |
|
|
The in-band metadata track dispatch type of the text track. |
|
|
The kind of the text track, represented by a value from the following list: |
|
|
The label of the text track. |
|
|
The language of the text track. |
|
|
The mode of the text track, represented by a value from the following list: |
|
The ready state of the text track. |
||
|
The source of the text track. |
|
The content type of the text track. |
||
|
A unique identifier of the text track. |
Method |
Description |
---|---|
addEventListener(type: |
Add the given listener for the given event type(s). |
removeEventListener(type: |
Remove the given listener for the given event type(s). |
The list of active cues of the track.
Signature:
readonly activeCues: TextTrackCueList | null;
- 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 is 'disabled'
, this property is null
.
The list of cues of the track.
Signature:
readonly cues: TextTrackCueList | null;
- If the is 'disabled'
, this property is null
.
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)
Signature:
readonly forced: boolean;
The identifier of the text track.
Signature:
readonly id: string;
- 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.
The in-band metadata track dispatch type of the text track.
Signature:
readonly inBandMetadataTrackDispatchType: 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.
Signature:
readonly kind: string;
The label of the text track.
Signature:
label: string;
The language of the text track.
Signature:
readonly language: 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.
Signature:
mode: string;
- 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.
Signature:
readonly readyState: TextTrackReadyState;
The source of the text track.
Signature:
readonly src: string;
The content type of the text track.
Signature:
readonly type: TextTrackType;
A unique identifier of the text track.
Signature:
readonly uid: number;
- 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.
Add the given listener for the given event type(s).
Signature:
addEventListener<TType extends StringKeyOf<TextTrackEventMap>>(type: TType | readonly TType[], listener: EventListener<TextTrackEventMap[TType]>): void;
Parameter |
Type |
Description |
---|---|---|
type |
|
The type of the event. |
listener |
EventListener |
The callback which is executed when the event occurs. |
Remove the given listener for the given event type(s).
Signature:
removeEventListener<TType extends StringKeyOf<TextTrackEventMap>>(type: TType | readonly TType[], listener: EventListener<TextTrackEventMap[TType]>): void;
Parameter |
Type |
Description |
---|---|---|
type |
|
The type of the event. |
listener |
EventListener |
The callback which will be removed. |