Let the <video/> light the page.
Video Lighting (videolight on npm) is an open-source JavaScript and React plugin for HTML video. It turns the colors along a video's edges, on every frame, into a glow, an ambient background or a themed interface. No blurred copy of the picture: just a color for each zone.
Paste the prompt into your AI assistant and it wires Video Lighting into your player.
This video runs on Video.js 10.
- React and plain JS: one component or one function per effect
- Every frame read
- 3.5 ms on Chrome, 4K, measured
We read the edges. We don't copy the picture.
YouTube's ambient mode blurs a copy of the frame behind the player, and an Ambilight TV lights the wall from the edges of the screen. Video Lighting does the second, in the browser: one color per edge zone, read on every frame.
12 ZONES ON THE LONG SIDES, 7 ON THE SHORT ONES: THE SAME SIZE EVERYWHERE, EVERY FRAME
Install it, pick an effect, done.
Add an ambient glow to an HTML video in a few lines. Halo lights the edges of the player, Ambient the page background, Theme the colors of your interface, and useColors hands you the raw colors. One read of the video is shared by every effect, and each one is a React component and a plain JavaScript function.
Works on any video your page can read: same-origin, or served with CORS headers.
Install
No dependencies. Works with any bundler, or without one.
Pick an effect
Each effect lights a different part of your page. These previews run on the real plugin, driven by the video above.
It measures your browser instead of guessing.
Browsers and machines disagree about what is fastest: reading a frame on the GPU wins on one, on the CPU on another, and a laptop under load is not the machine it was a minute ago. So Video Lighting tests, decides, and checks again, for as long as the video plays.
- 01
Measure
The same frames read both ways, through the GPU (WebGL) and the CPU (canvas), inside a worker.
- 02
Pick
Keep the faster path, only when it wins clearly, so it does not flip-flop between two near-equal paths.
- 03
Watch
Re-check when the machine slows down or speeds up, when the picture changes size, and on a timer. Then measure again.
No browser sniffing and no hard-coded list, so nothing goes stale when a browser updates. Where workers are not available, Video Lighting falls back to the main thread.
From the frame to the colors, in a few milliseconds.
Bars share one scale: 12 ms = full width. Measured on [machine, browser versions, date].
Off the main thread
Frames are handed to a worker, so scrolling and input stay smooth.
Every frame
Each presented frame is read. None skipped in our end-to-end tests on Chrome, Firefox and WebKit.
Before you add it to your player.
Does it work with YouTube or Vimeo embeds?
No. Video Lighting reads the pixels of a <video> element, and a browser does not let a page read inside an iframe from another site. It works with video you host, MP4 or HLS. DRM-protected video is not supported either.
Why is the glow blank on my video?
The browser must be allowed to read the pixels: same origin, or CORS headers plus crossorigin="anonymous" on the <video>. Pass onError to be told when reading is refused.
Which players does it work with?
This page runs on Video.js 10. Video Lighting only needs the <video> element, so a player that exposes it should work. Video.js 10 is the one we have tested so far.
Do I need React?
No. Each effect is a plain JavaScript function: halo(video), ambient(video), theme(video) and watch(video). The React components live in videolight/react (React 18 or later, React 19 tested).
Will it slow my page down?
The reading runs in a worker, off the main thread, and the engine picks the faster of GPU and CPU for each browser. See the measured figures above.