Interface TextTrack
activeCues: TextTrackCueList | null;
cues: TextTrackCueList | null;
id: string;
inBandMetadataTrackDispatchType: string;
kind: TextTrackKind;
label: string;
language: string;
mode: TextTrackMode;
oncuechange: ((this: TextTrack, ev: Event) => any) | null;
addCue(cue: TextTrackCue): void;
addEventListener<K extends "cuechange">(
type: K,
listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
dispatchEvent(event: Event): boolean;
removeCue(cue: TextTrackCue): void;
removeEventListener<K extends "cuechange">(
type: K,
listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
}
Hierarchy
- EventTarget
- TextTrack
Properties
ReadonlyactiveCues
The activeCues read-only property of the TextTrack interface returns a TextTrackCueList object listing the currently active cues.
Readonlycues
The cues read-only property of the TextTrack interface returns a TextTrackCueList object containing all of the track's cues.
Readonlyid
The id read-only property of the TextTrack interface returns the ID of the track if it has one.
ReadonlyinBandMetadataTrackDispatchType
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.
Readonlykind
The kind read-only property of the TextTrack interface returns the kind of text track this object represents.
Readonlylabel
The label read-only property of the TextTrack interface returns a human-readable label for the text track, if it is available.
Readonlylanguage
The language read-only property of the TextTrack interface returns the language of the text track.
mode
The TextTrack interface's mode property is a string specifying and controlling the text track's mode: disabled, hidden, or showing.
oncuechange
Methods
addCue
The
addCue()method of the TextTrack interface adds a new cue to the list of cues.Parameters
- cue: TextTrackCue
Returns void
addEventListener
- addEventListener<K extends "cuechange">(
type: K,
listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
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
- K extends "cuechange"
Parameters
- type: K
- listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
- addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
dispatchEvent
The
dispatchEvent()method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.Parameters
- event: Event
Returns boolean
removeCue
The
removeCue()method of the TextTrack interface removes a cue from the list of cues.Parameters
- cue: TextTrackCue
Returns void
removeEventListener
- removeEventListener<K extends "cuechange">(
type: K,
listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Type Parameters
- K extends "cuechange"
Parameters
- type: K
- listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
- removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
The
TextTrackinterface of the WebVTT API represents a text track associated with a media element.MDN Reference