Video lab: title editor, cinema sound, wide gamut, timeline skin, WebGPU player

Five experiments with a <video> as a canvas child. The first three share one WebGL canvas: choose a scene with the buttons. In the editor, tap the text of a title card on the canvas and type. In the cinema, tap play on the screen, then tap a seat. The last two sections have their own canvases further down.

Show the code one WebGL canvas for three scenes: shots and transitions, export, the room and its sound, the timeline skin
  1. One drawable canvas. Every shot, the cinema screen, the seat map and the player are its children.
  2. A title card is HTML. Its text is contenteditable.
  3. The card's motion is CSS driven by one custom property.
  4. Which shots are on screen at a time. Two shots overlap for the length of a transition.
  5. The editor's paint. Upload one or two shots with texElementSubImage2D() and draw one quad.
  6. The fragment shader. The transitions (three of them from lib/live-transition.js), the timeline skin, the screen and the floor.
  7. Export. exportFrames() is given an object that seeks the whole timeline.
  8. The seat map. Buttons whose place in the grid is their place in the room.
  9. The room. Three planes and a camera.
  10. The cinema's paint. The same matrix draws a quad and places its hit box.
  11. From a clip-space matrix to updateElementGeometry().
  12. The sound. The video element through a PannerNode at the screen.
  13. The timeline skin: the CSS.
  14. The timeline skin: finding the strip.
  15. The timeline skin: the paint.

Wide-gamut video in a Display P3 canvas

The same element (a video and three CSS swatches at the Display P3 primaries) is a child of two 2D canvases. The left context is sRGB and the right one is Display P3. On a wide-gamut screen the right canvas is more saturated. On any screen, "Read the pixels" reports the values and marks the pixels that sRGB can't hold.

sRGB context
Display P3 context
Map: pink marks a pixel of the Display P3 canvas that is outside sRGB. Empty until the pixels are read.
Not read yet.
Show the code a Display P3 context, and reading its pixels from a copy
  1. The canvas. getContext('2d', { colorSpace: 'display-p3' }) and one drawElementImage() per paint.
  2. Reading. A drawImage() copy in a plain canvas, read as Display P3 values.

The player shader in WebGPU

The shader of /player-fx/ in WGSL. The controls of the video are one texture and its frame is another. "Meld" draws the play button's glyph large as a lens over the frame while the video is paused: tap play to see it shrink into the button.

Starts when this section is near the screen.

Show the code two textures from one video in WebGPU, the WGSL shader
  1. The markup.
  2. The CSS that leaves only the controls in the element's picture, and the probe colours.
  3. The device. From webgpu() in /shared/backend.js, with a 2D fallback.
  4. The frame texture.
  5. The paint. drawElementImageToTexture() for the controls, then one render pass.
  6. Finding the parts. The probe picture is copied out of its texture once.
  7. The shader.

How it works

Live checks

The checks build their own small canvases in a corner of the window. The demos above aren't touched.

Findings

Measured in Chromium 157, headless, software rendering, on 2026-11-21. The rows above say what your browser does.