Video player
A React component in Beamline's Content & display category, in the free sample.
A video player on the native <video> element: title bar with an external link and close, centre play with ±10 s, scrub, time, volume, speed, captions drawn in the system's type, picture-in-picture and fullscreen; full keyboard control, and loading, buffering, ended and error states.
Use it for
- Product videos, walkthroughs and recordings inside an app or docs page.
Not for
- Background or decorative video (a muted, looping <video> without controls).
- Live streams that need adaptive bitrate (use a streaming player with HLS or DASH and style it on tokens).
Anatomy
- title bar (title, external link, close)
- centre controls (−10 s, play/pause, +10 s)
- captions
- control bar: play, scrub (names the time under the pointer), time, volume, speed, captions, picture-in-picture, fullscreen
- what a skip or a volume key just did (a pill on the side it moved toward)
- buffering spinner
- error panel
Variants
- 0: hide: skip · volume · speed · captions · pip · fullscreen
- 1: link (any external page)
- 2: poster
States
- loading (skeleton)
- paused
- playing (controls fade after 2.5 s of stillness; any movement, focus or key brings them back)
- buffering
- ended (replay)
- error (cannot play, with retry; the control bar and scrims step aside, the panel sits under the title bar and drops its icon and detail in a narrow player)
- muted
- captions on/off
- fullscreen
- picture-in-picture
- narrow (by its own width: the transcript link becomes an icon, the duration, volume and picture-in-picture fold below 20rem, speed below 24rem, the skip buttons below 18rem)
- server-rendered (picture-in-picture capability is detected after hydration, preserving the initial control tree)
Keyboard
- Space or K: play/pause
- ← / →: 5 s back/forward; J / L: 10 s
- ↑ / ↓: volume
- M: mute
- C: captions
- F: fullscreen
- Home / End: start / end
- 0–9: jump to that tenth of the video
- Keys work while focus is anywhere in the player except a slider, which keeps its own arrows
Motion
Controls use the current motion tokens. Play ↔ pause glyphs settle in from a little smaller once the person has toggled (never on first render). A skip or arrow key shows its result on the side it moved toward (“+10 s”), and repeated presses add up in the same pill (arrives, holds, fades over 5 × --pui-fade-out); a volume key shows the level. Captions drop to the bottom edge by transform while the controls are away. Reduced motion keeps the fades and drops the growth. The 2.5-second idle timeout remains reading time.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
src / poster | string | — | |
title | ReactNode | — | |
captions | VideoCaption[] | — | { src, srcLang, label, default? } WebVTT tracks; C cycles through them and off. |
link | { href, label } | — | An external page for the video (its original, a transcript), opened in a new tab. |
onClose | () => void | — | Shows a close button in the title bar. |
label | string | — | Accessible name; the title when it is text. |
autoPlay / muted / loop | boolean | — | |
autoFocus | boolean | — | Focus the player on mount so its keys work at once. |
playing / onPlayingChange | boolean / (playing) => void | — | Controlled play state. |
hide | ("skip" | "volume" | "speed" | "captions" | "pip" | "fullscreen")[] | — | Controls to leave out. Narrow players drop speed, then picture-in-picture, volume and the duration, on their own. |
loading | boolean | — | A skeleton while the source is not known yet. |
className / videoClassName | string | — | |
crossOrigin | "anonymous" | "use-credentials" | — | Request the video and captions with CORS. Needed only when captions come from another origin (which must then send CORS headers); leave it off otherwise, since it blocks servers and file:// pages that send none. |
classNames | VideoPlayerClassNames | — | Classes for the named visual parts; no overrides by default. |
style / ref | CSSProperties / native Ref | — | style: Inline styles on the documented visual root; no overrides by default. ref: Receives the documented native target or imperative handle; omitted by default. |
videoRef / videoStyle | Ref<HTMLVideoElement> / CSSProperties | — | |
style | CSSProperties | — | Inline styles on the documented visual root; no overrides by default. |
ref | Ref<HTMLDivElement> | — | Receives the documented native target or imperative handle; omitted by default. |
videoRef | Ref<HTMLVideoElement> | — | |
videoStyle | CSSProperties | — | |
src (required) | string | — | |
poster | string | — | |
autoPlay | boolean | — | |
muted | boolean | — | |
loop | boolean | — | |
playing | boolean | — | Controlled play state. |
onPlayingChange | ((playing: boolean) => void) | — | |
className | string | — | Classes on the documented visual root; no override by default. |
videoClassName | string | — |
Built from
Import
import { VideoPlayer } from "@beamline/video";
Get it
Video player is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Video player is included in the free MIT sample. Get Beamline · Connect your agent
More in Content & display
- Image compare: Two images in one frame with a divider: drag anywhere, or arrow keys on the handle; horizontal or vertical, with captions.
- Revision compare: Two revisions of a drawing on one camera: side by side, they pan and zoom together (a crosshair in one pane marks the point under the pointer in the…
- Live cursors: Who else is working on this, and where: over any shared surface, each person's pointer in the colour their name always gets, with a name flag, gliding…
- Document viewer: A PDF or a paged document read and marked up in place: page thumbnails beside it, zoom to the width, the page or a percentage, pages by keyboard, a…
- Lightbox: A full-screen image viewer: a thumbnail grows into it and shrinks back, arrows and ←/→ step through the set, Esc or a downward drag closes it.
- File diff: A change to one file as a unified diff: line numbers, tinted lines, only the changed words marked, long unchanged stretches folded; give rows or just…
- QR Code: A scannable code set as gradient dots with rounded finder rings and an optional centre mark; a new value ripples out from the centre.
- Data matrix: A DataMatrix (ECC 200, ISO/IEC 16022) any scanner reads: crisp square modules in SVG at any size, the smallest symbol that holds the value (10×10 to…
- Slot text: Text and numbers that roll into their new value on reels, digit by digit from the right; other characters fade. Read as plain text by assistive tech.
- Text reveal: A headline whose words rise into place once, the first time it scrolls into view; never repeats.
- Text morph: A short label that becomes its next state letter by letter: shared letters glide into place, new ones arrive, old ones leave.
- Code block: Code to read and copy: highlighted in the system's colours, numbered, marked lines, long files folded behind “Show all”.
- Inbox list: Conversations waiting for a person, triaged in place: sender, subject and the first words, time, unread weight, star, labels and attachments, grouped by…
- Comment thread: A discussion attached to something: replies, reactions, @mentions, editing and deleting your own, resolve that folds the thread.
- Timeline: What happened, newest first and grouped by day: people with avatars, systems with toned icons, relative times with the exact time on hover, details in…
- Description list: The details of one record as label and value pairs: beside each other or stacked, in as many columns as the room holds; a copy button arrives on the row…
- Text shimmer: Ongoing work said in words (“Thinking…”) with a calm band of light passing across them; stops when inactive.
- Logo Carousel: A wall of logos shown a few at a time: every few seconds the slots turn left to right, each logo leaving upward as the next rises in.
- Avatar group: A team in a small space: overlapping faces that name themselves on hover or focus, and “+N” naming the rest.
- Avatar: A person or account in a small space: a photo, or initials on the hue their name always gets; presence dot; circle for people, square for companies.
- Item: The generic list row: media, title, description, meta and trailing actions; becomes a link or button when interactive.
- Marker: A labelled point in a stream: a status event with an icon between messages, or a label such as "Today" between two hairlines.
- Credit: "Designed with Beamline" for a site's footer: the Beamline mark and a quiet line, or a small badge. With your partner code, each new customer's first…
- Badge: A short status, category or count label: six tones, an icon or a status dot, two sizes.
- Kbd: Keyboard keys as keycaps, for combinations and sequences (G then A); `mod` resolves to ⌘ or Ctrl per platform, symbols are spoken as words.