Scc Subtitle Plugin

This plugin is used to display one or more SCC subtitles.

How to use

const player = new ProgressivePlayer(...);
const sccSubtitlePlugin = new SccSubtitlePlugin(player);

// Add subtitles
sccSubtitlePlugin.add([
{
id: "en"
label: "English",
language: "en-US",
kind: "captions"
src: "https://example.com/movie_en.scc",
enabled: false
},
{
id: "sv"
label: "Swedish",
language: "sv-SE",
kind: "captions"
src: "https://example.com/movie_sv.scc",
enabled: false
}
]);

// Toggle subtitle
sccSubtitlePlugin.toggle("sv");

Known limitations

  • Colors do not work in Firefox as it does not support styling cues using selectors.

Deprecated

Use TimedTextPlugin instead. See migration guide

Hierarchy

Constructors

Properties

name: string
Name: string = SCC_SUBTITLE_PLUGIN_NAME

Accessors

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

    Returns boolean

  • set loaded(loaded): void
  • Parameters

    • loaded: boolean

    Returns void

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

    Returns boolean

  • set muted(muted): void
  • Parameters

    • muted: boolean

    Returns void

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

    Returns string

Methods

  • Adds cues to the given subtitle.

    Parameters

    • idOrSubtitle: string | SccSubtitle

      the id of the subtitle or the subtitle object

    • cues: VTTCue[]

      the cues to add

    Returns void

  • Adds an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

  • Unregisters itself with the player and removes all internal and external event listeners.

    Returns void

  • Disabled the given subtitle.

    Parameters

    • idOrSubtitle: string | SccSubtitle

      the id of the subtitle or the subtitle object

    Returns void

  • Enabled the given subtitle.

    Parameters

    • idOrSubtitle: string | SccSubtitle

      the id of the subtitle or the subtitle object

    Returns void

  • Plugin actions are optional and by default a plugin does not contain any actions.

    Returns PluginAction[]

  • Returns the subtitle state for the subtitle with the given id

    Parameters

    • id: string

      the subtitle id

    Returns SccSubtitle

  • Alias method for removeEventListener.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

  • Alias method for addEventListener.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

  • Removes the given subtitle.

    Parameters

    • idOrSubtitle: string | SccSubtitle

      the id of the subtitle or the subtitle object

    Returns void

  • Removes an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

  • Sets the start time of the given subtitle.

    Parameters

    • idOrSubtitle: string | SccSubtitle

      the id of the subtitle or the subtitle object

    • startTime: TimeCode

      the start time to set

    Returns void

  • Toggles (the enabled state) the given subtitle.

    Parameters

    • idOrSubtitle: string | SccSubtitle

      the id of the subtitle or the subtitle object

    Returns void