Options
All
  • Public
  • Public/Protected
  • All
Menu

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

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.

    • Optional config: ImscConfiguration

      IMSC specific configuration values.

    Returns ImscSubtitlePlugin

Properties

displayForcedOnlyMode

displayForcedOnlyMode: boolean

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

enableRollUp

enableRollUp: boolean

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

Readonly name

name: string

Static Name

Name: string = ...

Accessors

activeImscSubtitle

  • Returns the subtitle that is currently set as active in the plugin.

    Returns ImscSubtitle

activeImscSubtitleId

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

    Returns string

imscSubtitles

  • Returns an array of all subtitles that have been loaded into the plugin.

    Returns ImscSubtitle[]

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

originalParent

  • get originalParent(): HTMLElement
  • Returns the original parent that now contains the dynamically generated element that wraps the video and subtitles.

    Returns HTMLElement

version

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

    Returns string

Methods

activateImscSubtitles

  • activateImscSubtitles(): void
  • Actives or resumes the plugin functionality, and reveals any active subtitle cues.

    Returns void

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

deactivateImscSubtitles

  • deactivateImscSubtitles(): void
  • Pauses the plugin functionality, and hides any active subtitle cues.

    Returns void

destroy

  • destroy(): void
  • Destroys the plugin and removes any events and elements linked to it.

    Returns void

getPluginActions

  • getPluginActions(): PluginAction[]
  • Plugin actions are optional and by default a plugin does not contain any actions.

    Returns PluginAction[]

load

  • Loads the plugin with the specified TTML files.

    Parameters

    Returns Promise<ImscSubtitle[]>

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

setActiveImscSubtitle

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

    Parameters

    • id: string

      The ID of the subtitle to make active.

    Returns ImscSubtitle