Shaders that join the native controls and the video frame

One <video controls> gives a WebGL canvas two textures: its controls, and its frame. One fragment shader reads both. The page also finds where the play button, the timeline and four other parts are, although no script can reach them, so an effect can start at one part.

The controls are the browser's own and work as usual: tap the video to show them, then play, seek, mute, open the menu.

Show the code two textures from one video, finding the parts, the shader
  1. The markup. One video in a drawable element that fills the canvas.
  2. The CSS that leaves only the controls in the element's picture.
  3. Two textures. texElementSubImage2D() for the controls and texImage2D(video) for the frame, in the paint handler.
  4. Finding the parts: the CSS.
  5. Finding the parts: the readback.
  6. The fragment shader. Six effects. uParts holds the boxes that were found.

How it works

Live checks

Each check builds its own small player in a corner of the window. The player above isn't touched.

ResultExperimentDetail

Findings

From Chromium 157 with software rendering. The rows above say what your browser does.