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
Parameters
| Parameter | Type | Default | Details |
|---|---|---|---|
action* | string | undefined | — | |
| |||
value | number | — | |
| |||
Return Value
| Property | Type | Details |
|---|---|---|
aria | string | |
shortcut | string |