Options
All
  • Public
  • Public/Protected
  • All
Menu

This plugin is used to display one or more VttSubtitles that are stored as separate WebVTT files.

How to use

const player = new ProgressivePlayer(...);
const vttSubtitlePlugin = new VttSubtitlePlugin(player);

// Initialize subtitles
vttSubtitlePlugin.createSubtitles(listOfSubtitles);

// Enable subtitle
vttSubtitlePlugin.toggleSubtitle(subtitle);

Known limitations

This plugin will not work with the HlsPlayer while also using its built in vttSubtitles methods. I.e. in that case, a decision has to be made whether to use hls vttSubtitles or external vttSubtitles.

Hierarchy

Index

Constructors

constructor

  • Creates an instance of the plugin

    Parameters

    • player: Player

      The current player

    • Optional verbose: boolean

      Whether to log events or not

    Returns VttSubtitlePlugin

Properties

Readonly name

name: string

Static Name

Name: string = ...

Accessors

loaded

  • get loaded(): boolean
  • set loaded(loaded: boolean): void
  • Property that states whether this plugin considers itself ready for continued playback based on internal logic. Triggers internal event of type PlayerInternalEventType.LoadedChanged if property value was changed.

    Returns boolean

  • Property that states whether this plugin considers itself ready for continued playback based on internal logic. Triggers internal event of type PlayerInternalEventType.LoadedChanged if property value was changed.

    Parameters

    • loaded: boolean

    Returns void

muted

  • get muted(): boolean
  • set muted(muted: boolean): void
  • Property that states whether this plugin considers itself muted based on internal logic. Triggers internal event of type PlayerInternalEventType.MutedChanged if property value was changed.

    Returns boolean

  • Property that states whether this plugin considers itself muted based on internal logic. Triggers internal event of type PlayerInternalEventType.MutedChanged if property value was changed.

    Parameters

    • muted: boolean

    Returns void

version

  • get version(): string
  • Property describing the plugin name and version.

    Returns string

vttSubtitles

  • Gets an array of vttSubtitles, or an empty array if no vttSubtitles exists.

    Returns VttSubtitle[]

    An array of vttSubtitles, or an empty array.

Methods

addEventListener

  • addEventListener(type: string, callback: Listener): void
  • Adds an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

createVttSubtitles

  • createVttSubtitles(vttSubtitles: VttSubtitle[]): void
  • Initializes the given vttSubtitles and activates the ones set as enabled.

    Parameters

    • vttSubtitles: VttSubtitle[]

      The vttSubtitles to initialize.

    Returns void

deleteAllVttSubtitles

  • deleteAllVttSubtitles(): void
  • Hides all active vttSubtitles.

    Returns void

destroy

  • destroy(): void
  • Destroys the plugin and removes all vttSubtitle track elements that it created.

    Returns void

getPluginActions

  • getPluginActions(): PluginAction[]
  • Returns a list of hotkey actions connected to the plugin, primarily for internal use.

    Returns PluginAction[]

off

  • off(type: string, callback: Listener): void
  • Alias method for removeEventListener.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

on

  • on(type: string, callback: Listener): void
  • Alias method for addEventListener.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

removeEventListener

  • removeEventListener(type: string, callback: Listener): void
  • Removes an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

toggleVttSubtitle

  • Shows or hides a vttSubtitle based on if it exists in the DOM.

    Parameters

    Returns void