Skip to main content

Module screen_preview_canvas

Module screen_preview_canvas 

Source
Expand description

Live screen-capture preview canvas (AUT-269).

Replaces the recorder’s mock display-preview with the real screen being captured. Mirrors crate::camera_preview / crate::editor_preview_canvas: an [Effect] starts/stops the downscaled preview capture as the display section opens/closes (or the selected source changes), and a setInterval poll paints the latest frame (latest_screen_frame_bgra) into the canvas.

The backend captures downscaled to 1280×720 (screen_capture::PREVIEW_WIDTH / PREVIEW_HEIGHT) and excludes the recorder’s own windows, so the poll is cheap and the preview doesn’t capture itself (the screen-of-its-own-screen feedback loop).

Constants§

SCREEN_PREVIEW_CANVAS_ID
Stable DOM id for the screen-preview <canvas> (found by the poll).
SCREEN_PREVIEW_HEIGHT
Preview frame height — matches the backend screen_capture::PREVIEW_HEIGHT.
SCREEN_PREVIEW_POLL_MS
~15 fps poll interval (ms) — matches the camera/editor previews.
SCREEN_PREVIEW_WIDTH
Preview frame width — must match the backend screen_capture::PREVIEW_WIDTH so the polled BGRA bytes fit the canvas pixel-for-pixel (putImageData does not scale). The two crates can’t share a const (native vs wasm).

Functions§

install_screen_preview
Native stub — the screen preview runs only in the wasm webview.