Video Player
Play video from any source. The player comes styled, and you can replace or recompose every part of it.
Default player
This player uses the default skin with a title, a description, and chapters. Hover the timeline to see the chapter under the pointer, and open the settings menu to change quality, speed, captions, or Picture-in-Picture. To play audio in a single control bar, use the Audio Player.
Demo video
Hover the timeline to inspect chapters or open settings.
How the pieces fit together
A player has three required parts: the player, the skin, and the media. Each part has one job and nests inside the part above it, so you can change one without touching the others.
import { Title, Video, VideoPlayer, VideoSkin } from '@/components/ui/video-player';
<VideoPlayer title="Demo video" poster={posterUrl}>
<VideoSkin className="aspect-video w-full">
<Video src={videoUrl} playsInline />
<Title description="Optional subtitle line." />
</VideoSkin>
</VideoPlayer>;| Part | Component | What it owns |
|---|---|---|
| Player | VideoPlayer | Playback state for everything inside it. Takes title and poster, renders no UI. |
| Skin | VideoSkin | The interface: control bar, poster, loading and error states, shortcuts, gestures. |
| Media | Video, YouTubeVideo, HlsJsVideo, MuxVideo | The source. Renders the media element (or YouTube IFrame bridge) and nothing else. |
| Tracks | ChaptersTrack | Extra data for the media. Render it as a child of the media. |
| Additions | Title, TimedSlot, UpNext, UserPreferences | Optional overlays and behavior. Render them inside the skin. |
Any component inside the player can read playback state with usePlayer, even outside the skin:
import { selectTime, usePlayer } from '@/components/ui/video-player';
const currentTime = usePlayer((state) => selectTime(state)?.currentTime);Responsive layout
The control bar responds to the width of the player (@container/player), not the page, so the same player works in a sidebar and in fullscreen. Drag the slider to see it: the captions button drops first, then the time labels, so the timeline keeps its room.
Demo video
Drag the slider to resize the player.
Show video details
Poster
The poster is the image the player shows before playback. Set poster on VideoPlayer, not on the media, to use your own image. Pass renderPoster to VideoSkin to render a custom image component such as next/image.

Title and description
Set title on VideoPlayer, then render Title inside VideoSkin to show it. Title takes an optional description for a second line, which hides on players narrower than 448px.
Demo video
A second line under the title.
Pass visibility="fullscreen" when the page already shows the title next to the player and the overlay should appear only in fullscreen.
Chapters
Chapters split the timeline into segments and name the segment under the pointer. Render ChaptersTrack as a child of the media, with start times in seconds from the start of the video.
Internationalization
Pass locale to VideoSkin to translate labels, menus, and screen reader announcements, and automatically mirror right-to-left (RTL) locales such as Arabic (ar).
فيديو تجريبي
اختر لغة، ثم مرّر المؤشر فوق أحد الأزرار أو افتح قائمة الإعدادات.
Remember viewer preferences
Render UserPreferences inside VideoSkin to persist the viewer's volume, mute, speed, and captions in localStorage under player:preferences. Change a setting, then press Next video to mount a fresh player.
Video 1
Change the volume, speed, or captions, then load the next video.
Saved preferences: none yet
Timed overlays and Up next
TimedSlot renders its children over the video during a [start, end] range (negative values count back from the end). Bottom slots lift automatically while the control bar is visible. UpNext builds on TimedSlot to present the next item before playback finishes.
Video 1
A badge and skip button show between 0:05 and 0:35. Up next appears 10 seconds before the end.
Keyboard shortcuts and gestures
Shortcuts are active while focus is inside the player so multiple players on one page never compete for keys.
| Keys | Action |
|---|---|
Space, K | Play or pause |
← →, J L | Seek 10 seconds |
↑ ↓ | Change the volume |
M | Mute |
0–9 | Jump to 0% through 90% |
Home, End | Jump to the start or the end |
<, > | Play slower or faster |
C | Toggle captions |
F | Toggle fullscreen |
I | Toggle Picture-in-Picture |
Click plays or pauses; double-click seeks 10 seconds in the left or right third and toggles fullscreen in the center third.
Player states
Loading
Use Skeleton sized to the same aspect-video container while a player mounts.
Buffering
When playback waits for data for more than 500ms, the buffering indicator appears automatically.
Error
When the source cannot play, the skin shows a short message and disables controls.
Build your own control bar
The default control bar keeps every player in the product consistent. Replace it only when a surface cannot use it, such as a compact preview.
Compose PlayButton, TimeSlider, FullscreenButton, and other exported controls into a custom bar and pass it to VideoSkin via controls. Pass controls={null} to remove the bar completely.
Installation
pnpm dlx shadcn@latest add @narakui/video-playerAdd "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/video-player.json.
Reference
VideoPlayer
| Prop | Type | Description |
|---|---|---|
title | string | null | The title of the video |
poster | string | null | The image shown before playback. Replaces any poster the media generates |
VideoSkin
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Sizes the player, for example aspect-video w-full |
controls | ReactNode | null | <DefaultVideoControls /> | Replaces the default control bar. null removes it |
locale | string | Page language | Language of labels, tooltips, and RTL direction |
renderPoster | (props, state) => ReactNode | — | Custom renderer for the poster image |
Title
| Prop | Type | Description |
|---|---|---|
description | ReactNode | Second line under the title (hidden below 448px) |
visibility | 'inline' | 'fullscreen' | Restricts the title overlay to inline or fullscreen mode |
className | string | Additional classes for the title overlay |
ChaptersTrack
| Prop | Type | Description |
|---|---|---|
chapters | { startTime: number; title: string }[] | Required. Start times in seconds from the start of the media |
TimedSlot
| Prop | Type | Default | Description |
|---|---|---|---|
start | number | 0 | Start time in seconds (negative counts back from end) |
end | number | Video end | End time in seconds (negative counts back from end) |
open | boolean | true | Hides the slot inside its range when false |
placement | 'bottom-end' | 'bottom-start' | 'top-end' | 'top-start' | 'bottom-end' | Corner placement inside the player |
transitionIn | 'slide' | 'fade' | 'scale' | 'none' | 'slide' | Entrance transition style |
transitionOut | 'slide' | 'fade' | 'scale' | 'none' | Same as transitionIn | Exit transition style |
UpNext
| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | — | Title of the next video |
description | ReactNode | — | Short description (hidden below 512px) |
label | ReactNode | Translated “Up next” | Eyebrow label above the title |
thumbnailSrc | string | — | Preview thumbnail or animated GIF (hidden below 448px) |
href | string | — | Makes the card a link instead of a button |
seconds | number | 10 | Seconds before the end when the card appears |
onSelect | () => void | — | Called when the viewer clicks the card |
onComplete | () => void | — | Called when the media ends unless dismissed |