Screen capture with HTML annotation tools in one canvas

The picture is one 2D canvas with two drawable children: a <div> that holds a <video>, and a layer of annotations made of DOM. Draw on it with a finger, a pen or a mouse. The magnifier, the spotlight and the redact box change the video pixels under them. The video can be the test clip, the screen or the camera, and the canvas goes out as one stream.

Capture options for the Screen button, and controls for a running capture

The clip is the video. Screen and This tab call getDisplayMedia(). Each call and its result is written here.

Nothing sent or recorded yet. A live source can't use the frame-by-frame export of /overlay/: a screen or a camera can't be seeked.

Show the code a video, DOM annotations that change it, one stream out
  1. The markup. Two drawable children: one holds the video, one holds the annotations.
  2. The CSS. The glow, the fade animation and the annotation boxes.
  3. The paint handler. The frame with drawElementImage(), then the spotlight, the magnifier and the redaction with drawImage(video, sx, sy, …) and ctx.filter, then the layer with a second drawElementImage().
  4. A stroke. One SVG <path>. If PointerEvent.pressure varies, the path is a ribbon whose width follows it.
  5. The glow colour. The mean colour of the video under the stroke's points.
  6. The annotations. Each one is an element with its place in el.geo.
  7. Pointer events. One set of handlers on the canvas for touch, pen and mouse.
  8. The screen as the video. getDisplayMedia() with its options, then cropTo(), restrictTo() and the CaptureController calls.
  9. Out as one stream. canvas.captureStream() into a peer connection, or into MediaRecorder.
  10. The whole module.

How it works

Live checks

Each check builds its own canvas in a corner of the window. Its "screen" is the captureStream() of a second canvas, so no check asks for a permission. The picture above isn't touched.

ResultExperimentDetail

Findings

Measured on 2026-11-21. The canvas, the tools and the stream: Chromium 157 headless with software rendering. A real capture of a tab: Chromium 153 with a window, because the headless build can't start one. The rows above say what your browser does.