TextTrack
The TextTrack interface of the WebVTT API represents a text track associated with a media element.
Extends
Methods
addCue()
addCue(cue): void;
The addCue() method of the TextTrack interface adds a new cue to the list of cues.
Parameters
| Parameter | Type |
|---|---|
cue | TextTrackCue |
Returns
void
addEventListener()
Call Signature
addEventListener<K>(
type,
listener,
options?
): void;
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Type Parameters
| Type Parameter |
|---|
K extends "cuechange" |
Parameters
| Parameter | Type |
|---|---|
type | K |
listener | (this, ev) => any |
options? | boolean | AddEventListenerOptions |
Returns
void
Overrides
Call Signature
addEventListener(
type,
listener,
options?
): void;
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Parameters
| Parameter | Type |
|---|---|
type | string |
listener | EventListenerOrEventListenerObject |
options? | boolean | AddEventListenerOptions |
Returns
void
Overrides
EventTarget.addEventListener
dispatchEvent()
dispatchEvent(event): boolean;
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
Parameters
| Parameter | Type |
|---|---|
event | Event |
Returns
boolean
Inherited from
removeCue()
removeCue(cue): void;
The removeCue() method of the TextTrack interface removes a cue from the list of cues.
Parameters
| Parameter | Type |
|---|---|
cue | TextTrackCue |
Returns
void
removeEventListener()
Call Signature
removeEventListener<K>(
type,
listener,
options?
): void;
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
Type Parameters
| Type Parameter |
|---|
K extends "cuechange" |
Parameters
| Parameter | Type |
|---|---|
type | K |
listener | (this, ev) => any |
options? | boolean | EventListenerOptions |
Returns
void
Overrides
EventTarget.removeEventListener
Call Signature
removeEventListener(
type,
listener,
options?
): void;
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
Parameters
| Parameter | Type |
|---|---|
type | string |
listener | EventListenerOrEventListenerObject |
options? | boolean | EventListenerOptions |
Returns
void
Overrides
EventTarget.removeEventListener
Properties
activeCues
readonly activeCues: TextTrackCueList | null;
The activeCues read-only property of the TextTrack interface returns a TextTrackCueList object listing the currently active cues.
cues
readonly cues: TextTrackCueList | null;
The cues read-only property of the TextTrack interface returns a TextTrackCueList object containing all of the track's cues.
id
readonly id: string;
The id read-only property of the TextTrack interface returns the ID of the track if it has one.
inBandMetadataTrackDispatchType
readonly inBandMetadataTrackDispatchType: string;
The inBandMetadataTrackDispatchType read-only property of the TextTrack interface returns the text track's in-band metadata dispatch type of the text track represented by the TextTrack object.
kind
readonly kind: TextTrackKind;
The kind read-only property of the TextTrack interface returns the kind of text track this object represents. This decides how the track will be handled by a user agent.
label
readonly label: string;
The label read-only property of the TextTrack interface returns a human-readable label for the text track, if it is available.
language
readonly language: string;
The language read-only property of the TextTrack interface returns the language of the text track.
mode
mode: TextTrackMode;
The TextTrack interface's mode property is a string specifying and controlling the text track's mode: disabled, hidden, or showing. You can read this value to determine the current mode, and you can change this value to switch modes.
oncuechange
oncuechange: ((this, ev) => any) | null;