Video Player
jarvis-ui/video-playerFreeComponent
A themed media-chrome video player with composable controls.
Live preview
live · rendered by the registry
Rendered by jarvis-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.jarv.is/r/video-player.jsonSource
1"use client";23import {4 MediaControlBar,5 MediaController,6 MediaMuteButton,7 MediaPlayButton,8 MediaSeekBackwardButton,9 MediaSeekForwardButton,10 MediaTimeDisplay,11 MediaTimeRange,12 MediaVolumeRange,13} from "media-chrome/react";14import type * as React from "react";1516import { cn } from "@/lib/utils";1718type VideoPlayerVariables = React.CSSProperties & Record<`--${string}`, string>;19type VideoPlayerContentProps = React.ComponentProps<"video"> & {20 captionsSrc?: string;21 captionsLabel?: string;22 captionsSrcLang?: string;23};2425const videoPlayerVariables = {26 "--media-primary-color": "var(--primary)",27 "--media-secondary-color": "var(--background)",28 "--media-text-color": "var(--foreground)",29 "--media-background-color": "var(--background)",30 "--media-control-hover-background": "var(--accent)",31 "--media-font-family": "var(--font-sans)",32 "--media-live-button-icon-color": "var(--muted-foreground)",33 "--media-live-button-indicator-color": "var(--destructive)",34 "--media-range-track-background": "var(--border)",35} satisfies VideoPlayerVariables;36const emptyCaptionsSrc = "data:text/vtt,WEBVTT%0A%0A";3738function VideoPlayer({ style, ...props }: React.ComponentProps<typeof MediaController>) {39 return <MediaController style={{ ...videoPlayerVariables, ...style }} {...props} />;40}4142function VideoPlayerControlBar(props: React.ComponentProps<typeof MediaControlBar>) {43 return <MediaControlBar {...props} />;44}4546function VideoPlayerTimeRange({47 className,48 ...props49}: React.ComponentProps<typeof MediaTimeRange>) {50 return <MediaTimeRange className={cn("p-2.5", className)} {...props} />;51}5253function VideoPlayerTimeDisplay({54 className,55 ...props56}: React.ComponentProps<typeof MediaTimeDisplay>) {57 return <MediaTimeDisplay className={cn("p-2.5", className)} {...props} />;58}5960function VideoPlayerVolumeRange({61 className,62 ...props63}: React.ComponentProps<typeof MediaVolumeRange>) {64 return <MediaVolumeRange className={cn("p-2.5", className)} {...props} />;65}6667function VideoPlayerPlayButton({68 className,69 ...props70}: React.ComponentProps<typeof MediaPlayButton>) {71 return <MediaPlayButton aria-label="Play" className={cn("p-2.5", className)} {...props} />;72}7374function VideoPlayerSeekBackwardButton({75 className,76 ...props77}: React.ComponentProps<typeof MediaSeekBackwardButton>) {78 return (79 <MediaSeekBackwardButton80 aria-label="Seek backward"81 className={cn("p-2.5", className)}82 {...props}83 />84 );85}8687// … truncated
What it pulls in
npm packages
Files it writes
More from jarvis-ui
All 10 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Browser Windowbrowser-window | jarvis-ui | Components | Free | no deps | |
| Cookie Consentcookie-consent | jarvis-ui | Components | Free | no deps | |
| Copy Buttoncopy-button | jarvis-ui | Components | Free | 1 dep | |
| Copyable Fieldcopyable-field | jarvis-ui | Components | Free | no deps | |
| Parallax Cardparallax-card | jarvis-ui | Components | Free | 1 dep | |
| Scroll Areascroll-area | jarvis-ui | Components | Free | 1 dep | |
| Stepperstepper | jarvis-ui | Components | Free | 1 dep | |
| Tipovertipover | jarvis-ui | Components | Free | 1 dep · 2 files |
