Context
We have a working Playwright spike in the course-builder repo (tools/courseforge/demo-capture.py) that captures a full-workflow demo video of the CourseForge A1 LiDAR UI using Playwright's built-in video recording.
Spike results (validated in course-builder)
- Playwright records 1920x1080 WebM at 25fps with smooth mouse automation
- ffmpeg re-muxes to H.264 MP4 (1.5 Mbps, yuv420p) — fully compatible with the existing compose pipeline
- Video + audio mux confirmed: H.264 video + AAC audio combine cleanly via
ffmpeg -c:v copy -c:a aac
- The spike script runs headless on Ubuntu and produces ~3.5 MB for an 18-second demo
Proposal
Add type: playwright as a new visual source type alongside the existing type: manim and type: vhs sources.
Integration points
-
config.py — Accept type: playwright in visual_map entries with fields:
script: path to a Python capture script (like the spike's demo-capture.py)
url: target URL for the browser session
viewport: optional {width, height} override (default 1920x1080)
-
compose.py — In compose_segments(), dispatch type: playwright segments to a new PlaywrightRunner that:
- Launches headless Chromium via Playwright
- Executes the user-provided script (or a generic "navigate + wait" default)
- Returns the recorded video path for ffmpeg composition
-
CLI — Add docgen playwright subcommand for standalone capture (useful for testing scripts before full compose)
-
pyproject.toml — Add playwright to project dependencies
Reference
- Spike script:
menkelabs/course-builder@feature/playwright-capture-spike — tools/courseforge/demo-capture.py
- Milestone 2 already mentions "headless render — capture slide transitions as MP4 using Playwright or a headless browser"
- Existing
pytest-playwright in dev deps confirms Playwright is already in the toolchain
Acceptance criteria
Context
We have a working Playwright spike in the
course-builderrepo (tools/courseforge/demo-capture.py) that captures a full-workflow demo video of the CourseForge A1 LiDAR UI using Playwright's built-in video recording.Spike results (validated in course-builder)
ffmpeg -c:v copy -c:a aacProposal
Add
type: playwrightas a new visual source type alongside the existingtype: manimandtype: vhssources.Integration points
config.py— Accepttype: playwrightinvisual_mapentries with fields:script: path to a Python capture script (like the spike'sdemo-capture.py)url: target URL for the browser sessionviewport: optional{width, height}override (default 1920x1080)compose.py— Incompose_segments(), dispatchtype: playwrightsegments to a newPlaywrightRunnerthat:CLI — Add
docgen playwrightsubcommand for standalone capture (useful for testing scripts before full compose)pyproject.toml— Addplaywrightto project dependenciesReference
menkelabs/course-builder@feature/playwright-capture-spike—tools/courseforge/demo-capture.pypytest-playwrightin dev deps confirms Playwright is already in the toolchainAcceptance criteria
docgen playwright --script my_script.py --url http://localhost:3300produces an MP4type: playwrightsegments compose correctly with narration audio via the existing pipeline