Skip to content

Extension: pre-roll countdown with cancel and skip - #44

Merged
sardorml merged 1 commit into
mainfrom
feat/record-countdown
Oct 2, 2026
Merged

sardorml merged 1 commit into
mainfrom
feat/record-countdown

Conversation

@sardorml

@sardorml sardorml commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Adds a 3-2-1 pre-roll countdown to the extension recorder: after the user hits Start Recording and every grant/picker settles, a countdown overlays the page with cancel (✕ / Esc) and skip controls before the first frame is captured.

Flow

panel "record" → SW startRecording → offscreen acquires streams (picker, webcam, mic)
                                            │
                                   onCountdown() ──→ SW runCountdown
                                            │          • injects overlay into the active tab
                                            │          • owns the 3s clock
                                   "go" / "cancel" ←── skip / ✕ / Esc end it early
                                            │
                              "go" → upload session starts   "cancel" → tracks stopped, status "cancelled"

Design notes

  • Placement: the gate runs after all permissions and the native picker settle, and before the upload is created — cancelling costs nothing server-side (no multipart, no D1 row; reuses the existing picker-cancel cancelled path).
  • The worker owns the clock; the page only displays it. Navigation mid-countdown can kill the overlay, but capture still starts on schedule. Skip/cancel ride the same raw runtime-message channel as recorderOverlayClosed.
  • Overlay self-removes 150 ms before zero, so it never appears in the first recorded frames.
  • Restricted pages (no injection possible) degrade to the current instant start.
  • Overlay follows the content-script conventions: vanilla DOM, hand-scoped inline styles, serialized injected function — no framework in the page.

Verification

  • pnpm typecheck, extension tests 57/57, wxt build (prod + dev) all green.
  • Manual: dev build — countdown renders, numeral pulses per second; Esc, ✕ and skip all behave; recording starts cleanly after "1"; restricted pages record without the overlay.

A 3-2-1 overlay on the recorded page between stream acquisition and the
first recorded frame, with skip and cancel controls (buttons or Esc).

The gate sits after every grant and picker settles and before the upload
session is created, so a cancel tears down with nothing to clean up
server-side — it reuses the picker-cancel 'cancelled' status path.

The service worker owns the clock and starts capture on its own
schedule; the injected overlay (vanilla DOM, serialized function, like
the other page surfaces) only displays the count and can end it early
via the same raw runtime-message channel as recorderOverlayClosed. If
the tab navigates mid-count the recording still starts on time, the
overlay self-removes 150ms before zero so it never lands in the first
frames, and restricted pages fall back to today's instant start.
@sardorml
sardorml marked this pull request as ready for review October 2, 2026 07:58
@sardorml
sardorml merged commit 9e0943e into main Oct 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant