A recorded clip (a robot's camera recording, an incident clip) with the kit's controls over a native video: play, a timeline with event markers, time, mute, speed, captions and full screen on a scrim; keys while focused; loading, buffering and unavailable states.
Space or K plays and pauses, the arrow keys move 5 seconds, J and L 10 seconds, M mutes, F goes full screen.
0:00
1:00
Events in this clip
Media player incident
Install
npx shadcn add @syncrobotic/media-player Also installs: lucide-react, @syncrobotic/cn, @syncrobotic/button, @syncrobotic/slider, @syncrobotic/spinner
Overview
A recorded clip with the kit's own controls over a native video: play, a timeline with event markers, time, mute, speed, captions and full screen.
When to use
- A robot's camera recording of a patrol or a mission.
- The clip attached to an incident, opened at the moment it fired.
- Reviewing what a robot saw before a stop, with its events marked on the timeline.
Use something else
- A live camera feed: Camera feed (no timeline or speed; latency and connection state instead).
- One still frame with what a model saw in it: Annotated image.
- Many clips or pictures to pick from: Image grid, then the player for the one opened.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Space or K plays and pauses, the arrow keys move 5 seconds, J and L 10 seconds, M mutes, F goes full screen.
0:40
1:00
Media player at event
Space or K plays and pauses, the arrow keys move 5 seconds, J and L 10 seconds, M mutes, F goes full screen.
0:00
1:00
Media player plain
Space or K plays and pauses, the arrow keys move 5 seconds, J and L 10 seconds, M mutes, F goes full screen.
Media player loading
Space or K plays and pauses, the arrow keys move 5 seconds, J and L 10 seconds, M mutes, F goes full screen.
Clip unavailable: the robot uploads it when it next docks.
Media player not uploaded
Usage rules
- For a recorded clip with an end. A live camera is
camera-feed: no timeline, no speed, a latency and a connection state instead. - Give
labelthe clip's who, where and when ("Patrol dog 7F3A, front camera, 14:02"); it names the player for screen readers. - Pass
durationfrom the clip's record, so the time and the markers show before the file loads;preload="none"in a long list of clips. - Markers are events in the clip (Obstacle, Stop pressed), a word each, at most a handful. They are listed under the player too, for the keyboard and screen readers.
- Never autoplay with sound.
autoPlaystarts muted and does nothing for someone who asked for reduced motion. - When the clip cannot play, say why after "Clip unavailable:" (not uploaded yet, expired, the robot was offline) and offer a retry only when retrying can help.
Changelog
- 0.21.22026-11-21Compiles with noUncheckedIndexedAccess, as strict products build it; behaviour unchanged.
- 0.21.12026-11-21A duration hint that arrives later is taken in the render that brings it instead of an effect later, so it is safe under the React Compiler.
- 0.21.02026-11-20First release: MediaPlayer (label, src, poster, duration, startAt, markers, tracks, loading, unavailable, onRetry, autoPlay, preload, labels) over a native <video>: play / pause, a timeline (the kit's Slider, read as "0:42 of 1:00") with marker ticks and a list of markers under the player, time in tabular numbers, mute, speed 0.5–2×, captions drawn above the controls, full screen. Space / K, ← / →, J / L, M and F while focus is in the player. Controls on a scrim in the dark theme, hidden while playing once the pointer rests, kept while a finger is on them; no autoplay under reduced motion; loading, buffering and "Clip unavailable: …" with a retry.