Skip to content

ReferenceGestures

useHotkeyShortcut

Hook that reads display and ARIA metadata for a registered Player hotkey

Import

import { useHotkeyShortcut } from "@videojs/react";

Usage

Look up a registered action to keep a custom control’s visible shortcut and aria-keyshortcuts value synchronized.

function PlayShortcut() {
  const { aria, shortcut } = useHotkeyShortcut("togglePaused");

  return <button aria-keyshortcuts={aria}>Play ({shortcut})</button>;
}

The hook subscribes to registration changes. It returns empty details when the player container or action is unavailable; pass value for actions with value-specific registrations.

API Reference

useHotkeyShortcut(action, value?): HotkeyShortcutDetails

Parameters

ParameterTypeDefaultDetails
action*string | undefined—
valuenumber—

Return Value

PropertyType
ariastring | undefined
shortcutstring | undefined