App components / Video players
Video player
A video with a raised control bar: play, mono time, a scrubber, sound, captions, speed and full screen. It drives a real <video> element, and without a source it draws a flat placeholder and runs a clock so every control still works.
Code
The component itself, ready to drop into your project. Switch between React, Vue and plain HTML; every version uses the same Tailwind classes on Ochre's tokens.
Space or K plays and pauses. Left and right arrows skip five seconds. Up and down arrows change the volume. M mutes, C turns captions on, F goes full screen.
Installation
Examples
States
Paused, Playing and Loading.
paused
Space or K plays and pauses. Left and right arrows skip five seconds. Up and down arrows change the volume. M mutes, C turns captions on, F goes full screen.
playing
Space or K plays and pauses. Left and right arrows skip five seconds. Up and down arrows change the volume. M mutes, C turns captions on, F goes full screen.
loading
Space or K plays and pauses. Left and right arrows skip five seconds. Up and down arrows change the volume. M mutes, C turns captions on, F goes full screen.
Motion
Built on Ochre's ease-out curves. With reduced motion switched on, everything still works, it just doesn't move.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| state | "paused" | "playing" | "loading" | "paused" | State=Paused, Playing or Loading: the state it opens in. Playing starts muted; Loading holds the spinner until the source can play. |
| src / poster | string | – | The video file and its first frame. Without src the player draws the placeholder and runs a clock over duration. |
| title | string | – | Read out as the player's name. |
| duration | number | 0 | Length in seconds, used with no source and until the file's own length is known. |
| captions | { start, end, text }[] | – | Caption cues. The captions button appears when there are some; C toggles them. |
| markers | number[] | – | Chapter starts in seconds, drawn as notches on the scrubber. |
| speeds | number[] | [0.5, 1, 1.5, 2] | The choices in the speed tray. |
| onTimeChange / onStateChange | (value) => void | – | Called as the time moves and when the state changes, for Chapters and analytics. |
| ref | { play, pause, seek(seconds) } | – | Drive the player from outside, as Chapters does. |
Usage
Use it for
- Product tours, lessons and recorded calls inside an app or a help centre.
- Beside Chapters when the video runs longer than a few minutes.
Avoid
- Autoplaying with sound. Playing opens muted, as browsers require, and waits for the viewer to turn it up.
- Hiding the bar while paused: it only fades away during playback, after a moment of stillness.
- Stock gradients as a poster. Without a frame of the real video, the flat placeholder is honest.