Video Player
A film-first video player with zero dependencies — no library, no build step, no icon set. The controls are text: Play, Mute, a timecode and a hairline scrubber, sitting over the footage in white under mix-blend difference so they read on any frame without a gradient scrim, invisible until the player is hovered. Ambient mode starts muted playback while the player is in view — triggered from script rather than the autoplay attribute, which low-power mode ignores; a refused play() just leaves the buttons in charge. First built for the work slider on jameszamyslianskyj.com, extracted here as a reusable component.
Specification
- ID
- STDR_006
- Status
- Developing — API may change until v1.0.0
- Stack
- Vanilla JS · IntersectionObserver · React port
- Dependencies
- None
- Licence
- MIT
- CodePen
- Fork on CodePen ↗
Quick start
<link rel="stylesheet" href="stdr-video-player.css">
<div data-player>
<video src="/film.mp4" preload="auto" muted loop playsinline></video>
</div>
<script src="stdr-video-player.js"></script>
<script>
new STDRVideoPlayer('[data-player]', {
ambient: true, // muted autoplay while in view, paused out of it
inView: 0.5, // fraction visible before ambient playback starts
});
</script>
Notes
Canonical version is vanilla JS; the React port mirrors its behaviour and unwinds everything on unmount. The root just needs to contain a video element — the player builds its own control bar. The scrubber repaints from a requestAnimationFrame loop while playing, since timeupdate is too coarse for a moving indicator, and the mute label follows the volumechange event because ambient mode also flips muted. An explicit pause outranks ambient resumes. Touch devices and reduced-motion users get the controls permanently visible; ambient autoplay is skipped entirely under prefers-reduced-motion. Full API in the repo README.