Vinyl Scrubber
A media timeline shown as a photographic suitcase turntable rendered with three.js: the record turns with the position at 33⅓ rpm and a drag on it scratches back and forth, the tonearm follows the track, and the waveform strip under it is UI SDK's slider in seconds. The 3D scene draws in a worker after the controls paint, with a drawn turntable without WebGL. It controls an HTMLMediaElement or works controlled, with seek, play and pause for agents.
Example
Installation
lucide-reactthree@0.185.1Usage
Reach for it as the timeline of a music or DJ-flavoured player. Pass media for an audio or video element, or value and duration to drive it yourself.
API reference
VinylScrubber
| Prop | Type | Default |
|---|---|---|
labelrequiredThe accessible name of the player as a whole. | string | – |
mediaThe audio or video it controls: it follows its time and playback, and seeks, plays and pauses it. | RefObject<HTMLMediaElement | null> | – |
valueThe position in seconds. Pass it to control the scrubber. | number | – |
defaultValue | number | 0 |
durationThe length in seconds; read from `media` without it. | number | – |
onValueChangeRuns on every step of a drag, a scratch, a key or an agent's seek. | (seconds: number, details: VinylChangeDetails) => void | – |
playingWhether it plays. Pass it to control playback. | boolean | – |
defaultPlaying | boolean | false |
onPlayingChange | (playing: boolean, details: VinylChangeDetails) => void | – |
peaksLoudness along the track, each from 0 to 1, drawn as the waveform; a plain groove without them. | readonly number[] | – |
stepSeconds per arrow key; 5 by default. Page Up and Page Down move 30. | number | 5 |
titlePrinted big on the record's label. | string | – |
subtitlePrinted on the label under the title: a side, a track, an artist. | string | – |
disabled | boolean | false |
labels | Partial<VinylScrubberLabels> | – |
classNameClasses for the root; a function gets the player's state. | string | ((state: VinylScrubberState) => string | undefined) | – |
onPaintCalled with each paint's duration in ms, for measuring. | (milliseconds: number) => void | – |
Other exports
vinylScrubberLabelssecondsOfvinylScrubberarmAnglecameraFovDegreescameraPositioncameraTargetdeckToplabelRadiuspointOnRecordprojectToStagerecordCenterrecordPointAtrecordRadiusrecordTurnsecondsPerTurnuseVinylMediagrilleHolesgroovestangentsuseVinylSceneuseVinylClockuseVinylStagecreateVinylStagesupportsVinylStagecreateTurntableScenecreateVinylRunnerserveVinylRunnertype VinylChangeDetailstype VinylScrubberLabelstype VinylScrubberPropstype VinylScrubberStatetype VinylPlaytype VinylScrubberOptionstype VinylSeektype Vectortype MediaReadingtype DeckInputtype VinylStagetype LabelImagetype StageSizetype TurntableScenetype DeckStateAccessibility
- The waveform strip is a slider in seconds: arrows step by the step (5 s), Page Up and Page Down 30 s, Home and End the ends, and it reads as the time of the duration.
- Play is a toggle that stays pressed while it plays, with a tooltip.
- Under reduced motion the record doesn't spin between time updates.
- The 3D turntable is a picture hidden from assistive tech; the slider and the toggle carry everything it shows.
Agent actions
Agents find it by its label and call seek (seconds or "m:ss"), play and pause; a seek past the end, or before the duration is known, fails the step with why.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.