Skip to content

WebVTTAPI

Types

textTrack

This interface also inherits properties from EventTarget. See TextTrack on MDN

type textTrack = {
kind: textTrackKind,
label: string,
language: string,
id: string,
inBandMetadataTrackDispatchType: string,
mutable mode: textTrackMode,
cues: Null.t<textTrackCueList>,
activeCues: Null.t<textTrackCueList>,
}

Record fields

kind

Returns the text track kind string. Read more on MDN

label
string

Returns the text track label, if there is one, or the empty string otherwise (indicating that a custom label probably needs to be generated from the other attributes of the object if the object is exposed to the user). Read more on MDN

language
string

Returns the text track language string. Read more on MDN

id
string

Returns the ID of the given track.

For in-band tracks, this is the ID that can be used with a fragment if the format supports media fragment syntax, and that can be used with the getTrackById() method.

For TextTrack objects corresponding to track elements, this is the ID of the track element. Read more on MDN

inBandMetadataTrackDispatchType
string

Returns the text track in-band metadata track dispatch type string. Read more on MDN

mode

Returns the text track mode, represented by a string from the following list:

Can be set, to change the mode. Read more on MDN

cues
Null.t< textTrackCueList >

Returns the text track list of cues, as a TextTrackCueList object. Read more on MDN

activeCues
Null.t< textTrackCueList >

Returns the text track cues from the text track list of cues that are currently active (i.e. that start before the current playback position and end after it), as a TextTrackCueList object. Read more on MDN

Module

There are methods and helpers defined in TextTrack .

textTrackCue

TextTrackCues represent a string of text that will be displayed for some duration of time on a TextTrack. This includes the start and end times that the cue will be displayed. A TextTrackCue cannot be used directly, instead one of the derived types (e.g. VTTCue) must be used. See TextTrackCue on MDN

type textTrackCue = {
track: Null.t<textTrack>,
mutable id: string,
mutable startTime: float,
mutable endTime: float,
mutable pauseOnExit: bool,
}

Record fields

track
Null.t< textTrack >

Returns the TextTrack object to which this text track cue belongs, if any, or null otherwise. Read more on MDN

id
string

Returns the text track cue identifier.

Can be set. Read more on MDN

startTime
float

Returns the text track cue start time, in seconds.

Can be set. Read more on MDN

endTime
float

Returns the text track cue end time, in seconds.

Can be set. Read more on MDN

pauseOnExit
bool

Returns true if the text track cue pause-on-exit flag is set, false otherwise.

Can be set. Read more on MDN

textTrackCueList

type textTrackCueList = {length: int}

Record fields

length
int

Returns the number of cues in the list. Read more on MDN

Module

There are methods and helpers defined in TextTrackCueList .

textTrackKind

type textTrackKind =
| @as("captions") Captions
| @as("chapters") Chapters
| @as("descriptions") Descriptions
| @as("metadata") Metadata
| @as("subtitles") Subtitles

textTrackMode

type textTrackMode =
| @as("disabled") Disabled
| @as("hidden") Hidden
| @as("showing") Showing