Hotkey Plugin

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 (view full)

Constructors

Properties

name: string
Name: string = HOTKEY_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 an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns 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

  • Clear hotkeys filter function.

    Returns void

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

    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

  • Register a hotkey key combination to a specific action.

    Parameters

    • keyCombo: string

      Key combination to use.

    • callback: (() => void)

      A callback which is to be called when the key combination is pressed.

        • (): void
        • Returns void

    • description: string

      A short text describing the hotkey.

    • triggerEvent: boolean = true

      Optional flag, true by default. Triggers a HotkeysUpdatedEvent.

    • keyUp: boolean = false

      Optional flag, false by default. Causes the hotkey to trigger on keyup instead of keydown

    Returns void

  • Set a hotkeys filter function.

    Parameters

    • filter: ((event) => boolean)

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

        • (event): boolean
        • Parameters

          • event: KeyboardEvent

          Returns boolean

    Returns void