A video presenter over a slide made of DOM
The picture below is one canvas. It draws a slide that is HTML and, over it, a video with transparency: a clip with an alpha channel, or the camera with its background removed. Tap the slide's link, fill in its form and select its text, including under the video. Drag the round handle to move the presenter. Pick an effect, then send the canvas as a camera or record it.
Loading the clip.
Show the code a slide in two layers, a video between them
- The markup. The canvas has two
drawablechildren: the slide and its title. The presenter video isn't in the canvas. - The CSS of the two layers. The title layer has
pointer-events: noneand the title itself hasauto. - The 2D route.
drawElementImage()for each layer anddrawImage(video)between them. The shadow is the 2D context's own. - The shader of the WebGL route. The key, the shadow and the effects.
- The WebGL paint handler.
texElementSubImage2D()for each layer,texImage2D()for the video frame, thenupdateElementGeometry(). - The camera. What it reports for background blur and segmentation, and the mask route.
- Send and record.
loopback().recordCanvas().
How it works
- The slide is two elements of 640 by 360 layout pixels. The back one has the background and the body. The front one has the title. The presenter is drawn between them or after both.
- The presenter is drawn from a
<video>that isn't a child of the canvas. Nothing of it exists for hit testing, so every tap goes to the slide. - The clip with an alpha channel is drawn with a 2D context. A camera, the drawn figure and three of the effects need a shader. The page then makes a second canvas with a WebGL 2 context and moves the two slide elements into it.
- The video doesn't invalidate the canvas, because it isn't in it.
requestVideoFrameCallback()callsrequestPaint()for each frame. - The chroma key compares the chroma of each pixel with a key colour. The difference key compares each pixel with a frame captured when the person was out of the picture.
Live checks
Each check builds its own small canvas in a corner of the window. The picture above isn't touched. The last check asks for the camera.
| Result | Experiment | Detail |
|---|
Findings
From Chromium 157 with software rendering and its fake camera, 2026-11-21. The rows above say what your browser does.
- Works: the slide takes input under the presenter. A link, a radio button, a range input and a text field were used through the video's pixels, and text under it was selected. This holds on both routes.
- Works: alpha video by three routes. A
<video>child of a drawable element,drawImage(video)andtexImage2D(video)all keep the alpha of the VP9 clip. - Works: chroma key and difference key in one shader. Both need no browser support beyond
texImage2D(video). The difference key needs a still camera and a captured background. - Works: the composed canvas as a stream.
captureStream()throughRTCPeerConnectioncarries the slide and the presenter.MediaRecorderrecords it. - Limit: a presenter that is a
<video>element takes the taps. As a child of the slide it is hit on its clear pixels too. It needspointer-events: none. - Limit: the video raises no
paint. A video outside the canvas gave 0 paints a second until the page calledrequestPaint()for each frame. - Needed:
preserveDrawingBufferfor the WebGL stream. Without itcaptureStream()of the WebGL canvas gave black frames, because the canvas is drawn only in itspainthandler. The 2D canvas needs nothing. - Limit: the bend effect moves pixels, not hit boxes. A control drawn up to 27 pixels from its place is still hit at its place.
- Not available here: segmentation by the browser. The fake camera lists neither
backgroundBlurnorbackgroundSegmentationMaskingetCapabilities(). The mask route is written and hasn't run. - Not verified here: a real camera, the two keys on a real background, hardware-decoded alpha video, and the frame rate of the shader on a phone. The checks above and the status line under the picture report them on your device.