Mission: Design and implement a scalable, extensible “D‑and‑D Cutscene Audio/Video Manager”—a browser‑based timeline editor that lets Dungeon Masters assemble atmospheric cut‑scenes from any mix of audio tracks and video clips.
Core user goals
Multi‑file import – drag‑and‑drop any number of audio and video files; each file appears as a draggable “clip.”
Dual‑lane timeline – one lane for audio, one for video, sharing a common time‑ruler.
Clip editing – split, trim, resize, slip‑edit, duplicate, group, multi‑select, undo/redo; edges snap to grid or neighbour clips.
Clip roles – any clip or clip‑group can be tagged Intro, Loop, Outro.
Playback engine –
• space‑bar preview that honours the current timeline layout
• seamless intro → loop → outro flow; Loop may repeat until the DM triggers Outro
• cross‑fade at all segment boundaries
Export –
• project JSON for later re‑load
• WAV mix‑down of the audio lane
• MP4 mux (mixed audio + arranged video lane) via WebAssembly/ffmpeg
Quality of life – zoom, snap toggle, keyboard shortcuts, role‑coloured clips, theming, accessibility, i18n hooks, performance on >30 tracks.
Engineering expectations
Framework freedom – you may pick the front‑end stack (React/Redux, Vue, Svelte, vanilla, etc.) but justify the choice for scalability and maintainability.
Modular architecture – design with clear domain layers (UI / state / audio‑engine / export), dependency injection where sensible, plugin points for future effects or MIDI triggers.
Type safety – favour TypeScript or equivalent.
Worker off‑loading – long media operations (decode, mix‑down, ffmpeg) should not block the main thread.
Testing strategy – unit tests for utilities, integration tests for timeline ops, and e2e playback sanity checks (e.g. Playwright).
Tooling – lint, prettier, commit hooks, CI pipeline.
Documentation – high‑level architecture diagram, public API docs for plugin authors, and an onboarding README.
Deliverables
Solution outline – chosen tech stack, core libraries (waveform‑playlist, Tone.js, ffmpeg.wasm, etc.), high‑level component diagram, data models, and build pipeline description.
Incremental roadmap – sprint plan from MVP (load/preview a single audio clip) to full feature‑set.
Source code – organised in a mono‑repo (e.g. PNPM workspaces) with lint/test scripts, ready to run via pnpm install && pnpm dev.
Sample project files – demo JSON scene, example cutscene assets, and a short ‘getting started’ guide.
(Optional stretch) – plug‑in SDK example: add a real‑time reverb effect or MIDI foot‑switch trigger.
Important: This prompt is spec‑only—do not output production code until asked; focus first on architecture and planning to maximise extensibility and developer velocity.