Skip to Content
The new glomex player is released! 🎉View upgrade guide

Interface: TextTrackList

A collection of text tracks with selection support. Text tracks can be deselected by passing undefined to select().

Note: Text tracks are available after the integration.ready promise resolves.

The list is iterable and can be converted to an array:

Example

for (const track of integration.textTracks) { console.log(track); } const tracks = Array.from(integration.textTracks);

Extends

Properties

length

readonly length: number

The number of tracks in the list.

Inherited from

MediaTrackList.length


selected

readonly selected: TextTrack | null

The currently selected text track, or null if none is selected.

Methods

addEventListener()

addEventListener(type, listener, options?): void

Adds an event listener for track list changes.

Parameters

type

The event type: 'trackschange' (track list changed) or 'change' (selection changed).

"change" | "trackschange"

listener

EventListener

The callback function.

options?

Optional event listener options.

boolean | AddEventListenerOptions

Returns

void

Inherited from

MediaTrackList.addEventListener


getTrackById()

getTrackById(id): TextTrack | null

Returns the track with the specified ID.

Parameters

id

string

The track ID to search for.

Returns

TextTrack | null

The matching track, or null if not found.

Inherited from

MediaTrackList.getTrackById


select()

select(trackOrId): void

Selects a text track or disables text tracks.

Parameters

trackOrId

The track, track ID, or undefined to disable all text tracks.

string | TextTrack | undefined

Returns

void

Last updated on