Join us online - 19th of November
Save your spot
For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface TextTrack

The TextTrack interface of the WebVTT API represents a text track associated with a media element.

MDN Reference

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
Index
activeCues: TextTrackCueList | null

The activeCues read-only property of the TextTrack interface returns a TextTrackCueList object listing the currently active cues.

MDN Reference

cues: TextTrackCueList | null

The cues read-only property of the TextTrack interface returns a TextTrackCueList object containing all of the track's cues.

MDN Reference

id: string

The id read-only property of the TextTrack interface returns the ID of the track if it has one.

MDN Reference

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.

MDN Reference

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.

MDN Reference

label: string

The label read-only property of the TextTrack interface returns a human-readable label for the text track, if it is available.

MDN Reference

language: string

The language read-only property of the TextTrack interface returns the language of the text track.

MDN Reference

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.

MDN Reference

oncuechange: ((this: TextTrack, ev: Event) => any) | null
  • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

    MDN Reference

    Type Parameters

    • K extends "cuechange"

    Parameters

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

    MDN Reference

    Parameters

    Returns void

  • 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().

    MDN Reference

    Parameters

    • event: Event

    Returns boolean

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

    MDN Reference

    Type Parameters

    • K extends "cuechange"

    Parameters

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

    MDN Reference

    Parameters

    Returns void

Was this helpful?