IMSC Subtitle Plugin

This plugin is used to provide support for IMSC subtitles.

How to use

const player = new ProgressivePlayer(...);
const imscSubtitlePlugin = new ImscSubtitlePlugin(player);

// Load the IMSC TTML files into the plugin and set the first one marked
// as active as the active subtitle
// (label and language can be set manually if missing from TTML file)
const imscSubtitles = await imscSubtitlePlugin.load([{
src: <file-url>,
id: "subtitle-ger"
},
{
src: <file-url>,
id: "subtitle-esp",
active: true
},
{
src: <file-url>,
id: "subtitle-eng",
label: "Manual label",
language: "en"
}]);

// Switch subtitle
imscSubtitlePlugin.setActiveImscSubtitle("subtitle-ger");

// Temporarily disable subtitles
imscSubtitlePlugin.deactivateImscSubtitles();

// Re-enable subtitles
imscSubtitlePlugin.activateImscSubtitles();

// Remove subtitles and dispose of plugin
imscSubtitlePlugin.destroy();

Known limitations

Currently only supports rendering one ISMC subtitle file at a time.

Unsupported IMSC features

  • Property tts:fontShear is unsupported. We do support tts:shear.
  • Property tts:rubyAlign only support values "center" or "spaceAround".

Deprecated

Use TimedTextPlugin instead. See migration guide

Hierarchy

Constructors

Properties

displayForcedOnlyMode: boolean

Whether to only display regions where itts:forcedDisplay has been set to true.

enableRollUp: boolean

Whether to enable roll-up captions as specified in CEA-708.

name: string
Name: string = IMSC_SUBTITLE_PLUGIN_NAME

Accessors

  • get activeImscSubtitle(): ImscSubtitle
  • Returns the subtitle that is currently set as active in the plugin.

    Returns ImscSubtitle

  • get activeImscSubtitleId(): string
  • Returns the ID of the subtitle that is currently set as active in the plugin.

    Returns string

  • get imscSubtitles(): ImscSubtitle[]
  • Returns an array of all subtitles that have been loaded into the plugin.

    Returns ImscSubtitle[]

  • 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 originalParent(): HTMLElement
  • Returns the original parent that now contains the dynamically generated element that wraps the video and subtitles.

    Returns HTMLElement

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

    Returns string

Methods

  • Actives or resumes the plugin functionality, and reveals any active subtitle cues.

    Returns void

  • Adds an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

  • Pauses the plugin functionality, and hides any active subtitle cues.

    Returns void

  • Destroys the plugin and removes any events and elements linked to it.

    Returns void

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

    Returns PluginAction[]

  • 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 an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

  • Sets the active subtitle to the one matching the specified ID.

    Parameters

    • id: string

      The ID of the subtitle to make active.

    Returns ImscSubtitle