# Browser Presenter View (#729) The audience window owns slide playback, animation, media, navigation and the clock. A separate, same-origin browser popup displays the shared `presenter_body` over an audience `Snapshot`. It has the desktop Presenter View's current and next pictures, rich notes, timer, controls, zoom selection and All slides grid. It never advances a local show. ## Window lifecycle `presenter::opener` supplies `Services::presenter` with a framework `WindowLink`, implemented by `PopupOpener`. Opening it requests `popup,width=1100,height=700`. The framework gives the popup a `#craft-link=` role token. The browser entry point detects that role with `role_token` and constructs `PopupApp` with its platform `InstallSpec`. `PopupApp` installs its runtime and fonts through `embed::install` and calls `embed::before_input` and `embed::logic` through its eframe hooks. Its document title is “Presenter View — DeckCraft”. `PopupPeer::connect` attaches to the audience and sends the ready handshake. Failure to connect returns “The audience window is unavailable” to the entry point. The link reports a blocked popup to the audience; browser policy may require allowing popups before another opening attempt. A close or drop of the audience's opener closes its owned popup. The peer's close or drop detaches its listener and clears its inbox without closing the audience. Native show and presenter windows use the framework window host. The popup shows centred, informational `Notice`s, in this precedence: - “The audience window has closed.” when the link is closed. - “The audience window is not responding.” after ten seconds without an accepted link message, with “Return to the audience window to resume the connection.” - “Waiting for the audience window…” until the first snapshot arrives. These states have no action buttons. The timeout compares `Date::now()` with the peer's `last_heard()` timestamp, both in browser epoch milliseconds. Periodic repaint detects a quiet or closed audience even when no message wakes the page. ## Commands and snapshots The popup's `AppShell::page` is an instance of the shared show command scope. `presenter_body` emits `Command::Run` with a `ShowCommands` identifier, `Goto` with a zero-based slide index, or `Zoom` with unit picture coordinates. Typed digits are the `Digit0` through `Digit9` command identifiers inside `Run`. The audience resolves identifiers through `ShowCommands::from_ref` and applies the resulting command to its own show. The popup uses the shared body's command routing and focus handling, including keyboard activation of All slides tiles. The framework transports app JSON text inside its `{type: "deckcraft:link", token, kind, payload}` envelope. It verifies the exact counterpart source, page origin and opening token, bounds the queue to 64 messages, accepts commands up to 8192 bytes and snapshots up to 16 MiB. `Command::from_payload` refuses malformed JSON, unknown or legacy variants and nonfinite zoom coordinates. `SnapshotDelta::from_payload` requires a finite positive slide aspect and actual boolean `currentChanged` and `nextChanged` flags. Snapshots carry rich `TextBody` notes, elapsed seconds and document aspect, including while pictures are pending. `DeltaCache::send` suppresses images only after successful transport. Each ready handshake, including popup reload, requests a full refresh. A failed refresh remains unacknowledged, so the following send retries the complete state even after the ready signal has been consumed. Explicitly absent previews are sent with their change flags set. The popup drains each pass's arriving payloads in order. `merge` keeps an image when its change flag is false, replaces or clears it when true, and keeps the grid when `slides` is omitted. An empty slide list clears the grid. A second pass within one frame sees only its own arrivals and input. Accepted image changes bump revisions in the popup's `TextureStore`; painting reuses the textures without comparing pixel buffers each pass. Grid texture keys preserve slide indices. ## Validation Native protocol tests cover failed sends, reload refresh retries, explicit clears, delta merging, command rejection and round trips, mandatory boolean flags and invalid document aspect. The shared-body kittest trials cover focused Next activation, Space without duplicate commands, All slides picks and Enter on a focused tile, including a rerun within a frame. Preview tests check bounded dimensions, preserved aspect and pixel round trips. Framework popup tests own transport identity, ready handshakes, queue limits and lifecycle checks. Source review alone does not establish browser compatibility. Builds, test execution, browser popup/reload checks and visual comparisons remain for the integration validation run.