|
| 1 | +# Testing the Video Compositor UI |
| 2 | + |
| 3 | +## Overview |
| 4 | +The video compositor node (`video::compositor`) has a visual canvas in the Design view where layers (input video, text overlays, image overlays) can be positioned, resized, and configured. |
| 5 | + |
| 6 | +## Setup |
| 7 | +1. Start backend: `SK_SERVER__MOQ_GATEWAY_URL=http://127.0.0.1:4545/moq SK_SERVER__ADDRESS=127.0.0.1:4545 just skit` |
| 8 | +2. Start UI: `just ui` |
| 9 | +3. Navigate to `http://localhost:3045/design` |
| 10 | + |
| 11 | +## Loading a Compositor Pipeline |
| 12 | +- The easiest way to get a compositor node on the canvas is to load a pre-built sample |
| 13 | +- Click the **Samples** tab in the left sidebar |
| 14 | +- Click **"Video Compositor (MoQ Stream)"** to load a pipeline with a compositor node and two colorbars inputs |
| 15 | +- Another option: **"Webcam PiP (MoQ Stream)"** includes a compositor with a text overlay already configured |
| 16 | +- Drag-and-drop from the Nodes library is difficult with browser automation; prefer loading samples |
| 17 | + |
| 18 | +## Adding Text Overlays |
| 19 | +- The compositor node has a **Layers** panel with an **"Add"** button |
| 20 | +- The Add button may be offscreen in the node; use JavaScript `scrollIntoView()` + `click()` to interact with it |
| 21 | +- Click **Add > Text** to add a text overlay |
| 22 | +- The new text layer appears in the Layers list and on the canvas with a dashed bounding box |
| 23 | + |
| 24 | +## Configuring Text Overlays |
| 25 | +- Click a text layer in the Layers list to select it |
| 26 | +- The inspector panel shows: |
| 27 | + - **Content**: textarea for the text string |
| 28 | + - **Size**: number input for font size (in pixels) |
| 29 | + - **Font**: dropdown with DejaVu font variants |
| 30 | + - **Color**: color picker |
| 31 | + - **Opacity**: slider |
| 32 | + - **Rotation**: preset buttons (0/90/180/270) and slider |
| 33 | + - **Mirror**: horizontal/vertical toggle buttons |
| 34 | +- Use JavaScript `nativeInputValueSetter` + dispatching `input`/`change` events for React-controlled inputs |
| 35 | + |
| 36 | +## Key Behavior to Verify |
| 37 | +- Text should be aligned to the **top-left** of its bounding box (matching backend rendering from origin 0,0) |
| 38 | +- Font size should be proportional to the bounding box (no double-scaling from CSS transform) |
| 39 | +- The `CanvasInner` component applies `transform: scale(scale)` via CSS, so overlay content should use raw pixel values |
| 40 | +- Bounding box should auto-expand height to fit text content |
| 41 | + |
| 42 | +## Relevant Files |
| 43 | +- `ui/src/components/CompositorCanvas.tsx` — Main canvas component with overlay rendering |
| 44 | +- `ui/src/hooks/useCompositorLayers.ts` — Layer state management hook |
| 45 | +- `crates/nodes/src/video/compositor/overlay.rs` — Backend text rendering (uses fontdue) |
0 commit comments