logo

THEOplayer > TextTrack

TextTrack interface

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> 

Properties

Property

Type

Description

activeCues

TextTrackCueList | null

The list of active cues of the track.

cues

TextTrackCueList | null

The list of cues of the track.

id

string

The identifier of the text track.

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.

readyState

TextTrackReadyState

The ready state of the text track.

src

string

The source of the text track.

type

TextTrackType

The content type of the text track.

uid

number

A unique identifier of the text track.

Methods

Method

Description

addEventListener​(type: TType | TType[], listener: EventListener<TextTrackEventMap[TType]>): void

Add the given listener for the given event type(s).

removeEventListener​(type: TType | TType[], listener: EventListener<TextTrackEventMap[TType]>): void

Remove the given listener for the given event type(s).

Property Details

activeCues

The list of active cues of the track.

Signature:

readonly activeCues: TextTrackCueList | null;

Remarks


- 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

The list of cues of the track.

Signature:

readonly cues: TextTrackCueList | null;

Remarks


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

id

The identifier of the text track.

Signature:

readonly id: string;

Remarks


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

inBandMetadataTrackDispatchType

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

Signature:

readonly inBandMetadataTrackDispatchType: string;

kind

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;

label

The label of the text track.

Signature:

label: string;

language

The language of the text track.

Signature:

readonly language: string;

mode

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;

Remarks


- 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.

readyState

The ready state of the text track.

Signature:

readonly readyState: TextTrackReadyState;

src

The source of the text track.

Signature:

readonly src: string;

type

The content type of the text track.

Signature:

readonly type: TextTrackType;

uid

A unique identifier of the text track.

Signature:

readonly uid: number;

Remarks


- 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.

Method Details

addEventListener

Add the given listener for the given event type(s).

Signature:

addEventListener<TType extends StringKeyOf<TextTrackEventMap>>(type: TType | TType[], listener: EventListener<TextTrackEventMap[TType]>): void;

Parameters

Parameter

Type

Description

type

TType | TType[]

The type of the event.

listener

EventListener<TextTrackEventMap[TType]>

The callback which is executed when the event occurs.

removeEventListener

Remove the given listener for the given event type(s).

Signature:

removeEventListener<TType extends StringKeyOf<TextTrackEventMap>>(type: TType | TType[], listener: EventListener<TextTrackEventMap[TType]>): void;

Parameters

Parameter

Type

Description

type

TType | TType[]

The type of the event.

listener

EventListener<TextTrackEventMap[TType]>

The callback which will be removed.

github
Make sure to follow us on GitHub!
THEO-logo-white
twitter
facebook
linkedin
Copyright © 2020. All Rights Reserved.
Leuven
New York
Singapore
Barcelona