Options
All
  • Public
  • Public/Protected
  • All
Menu

Adds support for hotkeys

  • Adds a set of preconfigured hotkeys for basic player interactions like play, pause, seek, framestepping.
  • Automatically picks up hotkeys defined in other plugins.
  • Allows user to add custom hotkeys.

How to use

const player = new ProgressivePlayer(...);
const hotkeyPlugin = new HotkeyPlugin(player);
// Predefined hotkeys are ready to use.

const pointPlugin = new PointPlugin(player);
// Point plugin hotkeys for setting or clearing hotkeys are automatically added

// Add additional hotkeys.
hotkeyPlugin.setHotkey(
  "ctrl+shift+m",
  this.myCustomCallback(),
  "Description of hotkey."
);

// Fetch a list of hotkeys
hotkeyPlugin.currentConfigurations

Hierarchy

Index

Constructors

constructor

Properties

Readonly name

name: string

Static Name

Name: string = ...

Accessors

currentConfigurations

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

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

clearHotkey

  • clearHotkey(keyCombo: string, description?: string): void
  • Remove a specific hotkey.

    Parameters

    • keyCombo: string

      Key combination to remove.

    • Optional description: string

      Optional. Only remove hotkey if description matches the currently set hotkey.

    Returns void

clearHotkeysFilter

  • clearHotkeysFilter(): void
  • Clear hotkeys filter function.

    Returns void

destroy

  • destroy(): void
  • Unregisters itself with the player and removes all internal and external event listeners.

    Returns void

getPluginActions

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

    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

setHotkey

  • setHotkey(keyCombo: string, callback: () => void, description: string, triggerEvent?: boolean): void
  • Register a hotkey key combination to a specific action.

    Parameters

    • keyCombo: string

      Key combination to use.

    • callback: () => void
        • (): void
        • Returns void

    • description: string
    • triggerEvent: boolean = true

      Optional flag, true by default. Triggers a HotkeysUpdatedEvent.

    Returns void

setHotkeysFilter

  • setHotkeysFilter(filter: (event: KeyboardEvent) => boolean): void
  • Set a hotkeys filter function.

    Parameters

    • filter: (event: KeyboardEvent) => boolean

      the filter function that will be used to decide which event sources that are allowed for hotkeys.

        • (event: KeyboardEvent): boolean
        • Parameters

          • event: KeyboardEvent

          Returns boolean

    Returns void