Video Player
A styled video component with custom play/pause, mute, seek, and fullscreen controls, poster image, and keyboard shortcuts.
Basic
A styled video component with custom play/pause, mute, seek, and fullscreen controls, poster image, and keyboard shortcuts. Click the play button to interact.
0:00 / 0:00
Installation
Install the component via the CLI in one command.
npx @work-rjkashyap/unified-ui add video-playerpnpm dlx @work-rjkashyap/unified-ui add video-playernpx @work-rjkashyap/unified-ui add video-playerbunx @work-rjkashyap/unified-ui add video-playerIf you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.
Or install the full package
Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.
npm install @work-rjkashyap/unified-uipnpm add @work-rjkashyap/unified-uiyarn add @work-rjkashyap/unified-uibun add @work-rjkashyap/unified-uiAnatomy
import {
VideoPlayer,
Button,
} from "@work-rjkashyap/unified-ui";Examples
Default (16:9)
0:00 / 0:00
Aspect Ratios
video (16:9) — default
0:00 / 0:00
4/3
0:00 / 0:00
Autoplay, Loop & Muted
0:00 / 0:00
Without Controls
Without Poster
0:00 / 0:00
Muted by Default
0:00 / 0:00
onEnded Callback
0:00 / 0:00
Props
| Prop | Type | Default | Description |
|---|---|---|---|
src | string | — | Video source URL. |
poster | string | — | Poster image URL. |
aspectRatio | "video" | "square" | "4/3" | "auto" | "video" | Aspect ratio constraint. |
autoPlay | boolean | false | Auto-play the video. |
loop | boolean | false | Loop the video. |
muted | boolean | false | Start muted. |
controls | boolean | true | Show custom controls overlay. |
className | string | — | Additional CSS classes. |
onEnded | () => void | — | Callback when video finishes. |
Keyboard Shortcuts
| Key | Action |
|---|---|
Space / K | Toggle play/pause |
M | Toggle mute |
F | Toggle fullscreen |
→ | Seek forward 5 seconds |
← | Seek backward 5 seconds |
Accessibility
- Uses
role="region"witharia-label="Video player". - All control buttons have descriptive
aria-labelattributes. - Fully keyboard navigable — all shortcuts work when the player is focused.
- Big play button overlay when paused for clear affordance.
- Time display and progress bar provide temporal orientation.
- Focus ring visible on keyboard navigation via
focus-visible.
Browsers require muted to be set for autoPlay to work without user
interaction. Always pair autoPlay with muted for reliable behavior.
Design Tokens
| Token | Usage |
|---|---|
--border | Player container border |
--radius-lg | Player border radius |
--background | Controls gradient base |
--foreground | Control icon colors |
--primary | Focus ring color |
--duration-fast | Control transition speed |