Parser for iTunes Timed Text (.itt). See TimedTextPlugin for usage examples.

Hierarchy (view full)

Constructors

Properties

defaultEncoding: string = "utf-8"
OnMetadata: string = "metadata"

Event type emitted when parser reads metadata that should be passed to renderers

format: SubtitleFormat = SubtitleFormat.ITT

The format this parser is used for

Methods

  • Adds an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: ((...args) => void)

      Listener callback function.

        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional once: boolean

      (Optional) Indicating that the listener should be invoked at most once after being added. If true, the listener would be automatically removed when invoked.

    Returns void

  • Called when the parser is destroyed, when the subtitle is removed for example.

    Returns void

  • Fetches the remote url and returns the data to parse.

    This is called for sidecar files.

    Parameters

    • url: string

      the url to fetch

    Returns Promise<CueData<string>>

    Throws

    error on fetch error

  • Alias method for removeEventListener.

    Parameters

    • type: string

      Event type.

    • callback: ((...args) => void)

      Listener callback function.

        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

  • Alias method for addEventListener.

    Parameters

    • type: string

      Event type.

    • callback: ((...args) => void)

      Listener callback function.

        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional once: boolean

      (Optional) Indicating that the listener should be invoked at most once after being added. If true, the listener would be automatically removed when invoked.

    Returns void

  • Called when new data is available to parse.

    In the case of streaming subtitles this will be called several times during playback, as subtitle data becomes available.

    For sidecar files it is called once when the subtitle is loaded.

    Parameters

    • cueData: CueData<string>

      the cue data to parse

    Returns TimedTextCue[]

    Throws

    error on parse error

  • Removes an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: ((...args) => void)

      Listener callback function.

        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns void

  • Resets parser state (for stateful parsers).

    This is called when the users seeks to a new position in the video.

    Returns void