GuidePlayback
Add keyboard shortcuts and gestures
Add keyboard shortcuts, tap and double-tap gestures, and on-screen feedback for input actions.
Add keyboard shortcuts and pointer gestures to the player declaratively, with on-screen feedback and screen-reader announcements.
Recommended approach
Declare shortcuts with Hotkey and gestures with Gesture inside the player container. Each maps an input to a player action. The packaged skins include bindings suited to their player preset.
How it works
Hotkeybinds keys to player actions:togglePaused,toggleMuted,toggleFullscreen,toggleSubtitles,togglePictureInPicture,seekStep,volumeStep,seekToPercent,speedUp, andspeedDown.seekStepandvolumeStepuse a default step unless you pass a customvalue. These input actions call the feature actions your components use; for example,toggleFullscreenchoosesrequestFullscreenorexitFullscreenbased onisFullscreen.Gesturebindstapanddoubletapto the same actions. Gestures also supporttoggleControls;seekToPercentis available only to hotkeys. Scope each binding withpointer(mouseortouch) andregion(left,center,right). For example, a double tap on the left can rewind while a double tap on the right skips forward.StatusAnnouncerannounces action results to screen readers. The input indicator components show brief on-screen feedback, such as volume level or captions on and off, the way native players do. The packaged skins include both.
The on-demand video skins bind these keys:
- Space and
k: play and pause m: mutef: fullscreenc: captionsi: picture-in-picture- Left and Right arrows,
jandl: seek 10 seconds - Up and Down arrows: volume
0–9: jump to a percentage<and>: speed
Live video skins keep the playback, mute, volume, fullscreen, captions, and picture-in-picture shortcuts. They omit seeking and speed shortcuts.
How the container splits into regions depends on which regions you bind for the same gesture type and pointer type. Left and right bindings divide the container into halves. Adding a center binding divides it into thirds. A center-only binding covers the whole container; a left-only or right-only binding covers that half. These regions use the container’s width, not the rendered video’s width.
Availability and constraints
- Hotkeys listen on the player container by default, so multiple players on a page don’t fight over keys. Pass
target="document"on a hotkey to make it page-wide — appropriate only when one player owns the page. - Typing is protected: while focus is in an editable field, single-key bindings are skipped automatically. Modifier combinations (for example
Ctrl+Shift+f) still fire. - Repeatable actions (seeking, volume) fire on held keys; toggle actions don’t repeat.
- Use only one of
toggleControlsandtogglePausedfor tap bindings with the same pointer type. The packaged skins pause on a mouse tap and toggle controls on a touch tap, matching platform conventions. - Declared gestures and the built-in touch handling share one recognizer. Use the gesture components to add bindings. Extra raw pointer listeners can toggle controls twice.
Common variations
Customize a shortcut
For a packaged skin, add the skin source to your project and edit its Hotkey declarations. Adding another binding alongside the packaged skin does not replace its bindings. For a custom UI, edit your own Hotkey set directly.
Seek step size
Set the seekStep distance with value. Match it to your content: 5 seconds for short clips, 15 or 30 seconds for long-form video.
Troubleshooting
Shortcuts don’t fire
Focus is outside the player container. Click the player first, or move focus into it; hotkeys are player-scoped by design.
Double-tap seek also toggles pause
The built-in recognizer delays a matching single tap and cancels it when a double tap occurs. Check that your tap and double-tap bindings use compatible pointer filters. Remove separate click handlers that also toggle playback, and avoid native video controls on the same gesture surface.
No visual feedback on keyboard actions
The input indicator components render that feedback; use a packaged skin or add StatusAnnouncer and the indicator components from the skin source to a custom UI.