--- stepsCompleted: [1, 2, 3, 4, 5, 6, 7, 8] stepsReviewed: { "6": "party-mode" } workflowType: 'architecture' lastStep: 8 status: 'complete' completedAt: '2026-05-20' inputDocuments: - _bmad-output/planning-artifacts/briefs/brief-video-view-manager-2026-05-19/brief.md - _bmad-output/planning-artifacts/prds/prd-video-view-manager-2026-05-19/prd.md - _bmad-output/planning-artifacts/ux-design-specification.md workflowType: 'architecture' project_name: 'video-view-manager' user_name: 'Morr' date: '2026-05-20' --- # Architecture Decision Document: Video View Manager (Scrying Pool) _This document builds collaboratively through step-by-step discovery. Sections are appended as we work through each architectural decision together._ --- ## Project Context Analysis ### Requirements Overview **Functional Requirements:** 26 FRs across 5 feature groups implementing the Progressive Enhancement Architecture: - **Level 1 — Core Visibility Toggle (FR-1–8):** Right-click GM toggle on Scrying Pool's own roster strip, socket broadcast, world-level persistence, 8 Participant States (`active`, `hidden`, `self-muted`, `offline`, `cam-lost`, `reconnecting`, `never-connected`, `ghost`), visual state indicators, WebRTC track disabling with CSS fallback, Portrait Fallback. - **Level 2 — Director's Board (FR-9–14):** `ApplicationV2` floating window, seating-chart layout, per-card toggle, bulk Show/Hide with one-step undo, Spotlight with pre-spotlight snapshot, full keyboard navigation. - **Level 3 — Scene-Aware Presets (FR-15–19):** Save/load/auto-apply Visibility Matrix snapshots linked to FoundryVTT Scene activation, per-scene and global disable toggles, JSON import/export. _(Scope note: Level 3 is in-scope for v1.0 per PRD §6.1. If delivery risk materialises, FR-1–8 is the minimum shippable increment and Level 3 can shift to v1.1 without breaking the architecture — PRD §Cross-Cutting NFRs.)_ - **Contextual Notifications (FR-20–22):** 3-tier coalesced notification bus above `ui.notifications`, role-differentiated verbosity, persistent self-status badge on own tile. - **Player Privacy Panel (FR-23–26):** Per-user opt-in for future automation effects (Reaction Cam, HP-Reactive Styling), custom Portrait Fallback. **Non-Functional Requirements:** - State update latency ≤500ms (local network), all-client including Director's Board reflection - Director's Board renders interactive within 1s for 12 Participants - Socket payload ≤4KB per Visibility Matrix update - No blocking of FoundryVTT main render loop (async state application) - Graceful degradation when `game.webrtc` is unavailable — no errors, all UI hidden or disabled - Hook chaining required on all `Hooks.on()` registrations; no naked overrides - No external data transmission; no analytics or telemetry - WCAG AA: all interactive elements keyboard-navigable with ARIA labels - CSS scoped to `.scrying-pool` with SP semantic token alias layer over Foundry tokens **Scale & Complexity:** Medium-high for a FoundryVTT module. No infrastructure layer; FoundryVTT handles transport, persistence backbone, and rendering context. Complexity comes from real-time sync, optimistic UI with reconciliation, role-differentiated rendering, and 3-tier progressive UI. - Primary domain: Platform-embedded browser module (FoundryVTT v14 ES module) - Complexity level: Medium-high - Estimated core modules: 6–8 (`VisibilityManager`, `SocketHandler`, `StateStore`, `DirectorsBoard`, `NotificationBus`, `ScenePresetManager`, `PlayerPrivacyPanel`, `AudienceView/RoleRenderer`) --- ### Technical Constraints & Dependencies - **FoundryVTT v14 API only** — `ApplicationV2` for floating windows, `game.settings` for world/client persistence, native socket API for broadcast, `Hooks` system for lifecycle integration, `game.webrtc` / `AVMaster` for optional track disabling (OQ-1 unresolved) - **No external libraries** — Font Awesome 6 (Foundry-bundled) + Foundry CSS custom properties only; no UI frameworks, no socketlib - **ES module architecture** — standard FoundryVTT v14 module pattern - **CSS scoping discipline** — all selectors under `.scrying-pool`; `--sp-*` semantic tokens mapping to Foundry tokens with hardcoded fallbacks; `--color-*` / `--font-*` / `--border-*` Foundry tokens forbidden directly inside `.scrying-pool` - **Right-click surface** — must target Scrying Pool's own roster strip, NOT core AV tile DOM (WebRTC DOM is not a stable extension surface; `contextmenu` on `