A video player with a scrubbable seek bar, auto-hiding controls, keyboard shortcuts, speed, picture in picture and full screen.
Install
Add it to your project
Run this in a project set up for shadcn/ui. It writes the files and installs the npm packages.
First time: connect the Infinity UI registry
- Create a personal token on your Tokens page.
- Put it in
.env.localasINFINITYUI_TOKEN. - Add the registry to
components.json:
{
"registries": {
"@infinityui": {
"url": "https://infinityui.io/r/{name}.json",
"headers": {
"Authorization": "Bearer ${INFINITYUI_TOKEN}"
}
}
}
}Using Claude Code, Codex, Cursor, Lovable or v0? See CLI & MCP for a setup prompt.
npm packages it adds
- cn
- @base-ui/react
- @tabler/icons-react
- class-variance-authority
Code
import {
VideoPlayer,
VideoPlayerContent,
VideoPlayerControls,
VideoPlayerFullscreenButton,
VideoPlayerPictureInPictureButton,
VideoPlayerPlaybackRate,
VideoPlayerPlayButton,
VideoPlayerSeekBar,
VideoPlayerSeekButton,
VideoPlayerSpacer,
VideoPlayerTime,
VideoPlayerVolume,
} from "@/components/ui/video-player"
export function VideoPlayerDemo() {
return (
<VideoPlayer className="max-w-2xl">
<VideoPlayerContent
poster="https://media.w3.org/2010/05/sintel/poster.png"
aria-label="Sintel trailer"
>
<source
src="https://media.w3.org/2010/05/sintel/trailer.webm"
type="video/webm"
/>
<source
src="https://media.w3.org/2010/05/sintel/trailer.mp4"
type="video/mp4"
/>
</VideoPlayerContent>
<VideoPlayerControls>
<VideoPlayerSeekBar />
<VideoPlayerPlayButton />
<VideoPlayerSeekButton offset={-10} />
<VideoPlayerSeekButton offset={10} />
<VideoPlayerVolume />
<VideoPlayerTime />
<VideoPlayerSpacer />
<VideoPlayerPlaybackRate />
<VideoPlayerPictureInPictureButton />
<VideoPlayerFullscreenButton />
</VideoPlayerControls>
</VideoPlayer>
)
}
































