Skip to content

Restart video from the beginning on reveal#122

Merged
modem7 merged 2 commits into
masterfrom
fix/restart-on-reveal
Jul 9, 2026
Merged

Restart video from the beginning on reveal#122
modem7 merged 2 commits into
masterfrom
fix/restart-on-reveal

Conversation

@modem7

@modem7 modem7 commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • The video autoplays muted from t=0 the moment the page loads, but the decoy overlay (loading/error) can hold someone's attention for anywhere from a second to several minutes before they actually click it. By the time they do, the unmuted playback lands wherever the video has already drifted to - often well past the intro.
  • Seeks video.currentTime = 0 right before unmuting/playing in reveal(), so the payoff always starts from the actual song opening regardless of how long the click took.
  • Always-on behavior, no new env var - there's no real scenario where landing mid-song instead of on the intro is the desired outcome.

Buffering is unaffected by this change. The video still starts fetching/buffering the instant the page loads, exactly as before - it's still autoplaying muted the whole time the decoy is up, so playback is never "starting fresh" on click. This change only rewinds the playback position at the moment of reveal; it doesn't change when or how the browser loads the video. Since the start of the file is therefore already buffered (that's the part that's been playing muted since page load), seeking back to it on click is instant with no rebuffering or stutter.

Fixes #121

Also in this PR

  • Playwright's browser binaries are now cached across CI runs (pinned to an exact version so the cache key can't silently go stale), and the Docker build's video-fetch stage is cached via GHA cache the same way ghcr-publish.yml already does. Cuts a cold CI run from ~3min to ~1m30s.
  • test-autoplay.js now lets muted autoplay run for a few seconds before clicking, then asserts currentTime resets to near 0 after - regression coverage for the restart-on-reveal fix above.

Test plan

  • CI (test-autoplay.js, both overlays, Chromium + Firefox, including the new currentTime assertion) and test-mobile-fit.js all passing.
  • Verified on a second CI run that both new caches (Playwright browsers, Docker video-fetch layer) actually hit and skip re-downloading.
  • Manual check that clicking after a deliberate delay still starts the audio from the beginning.

The video autoplays muted from t=0 on page load, so by the time
someone actually clicks the decoy - anywhere from a second to
minutes later depending how long it holds their attention - the
audio unmutes wherever playback has already drifted to, often
cutting off the intro entirely.

Fixes #121
@modem7 modem7 self-assigned this Jul 9, 2026
- Cache Playwright's browser binaries (the slow part of installing it)
  across runs, keyed on a pinned exact version instead of a floating
  playwright@1. OS-level deps still install fresh every run since
  Actions runners aren't persistent, but that's fast on ubuntu-latest.
- Cache the Docker build's video-fetch stage via GHA cache, same as
  ghcr-publish.yml already does - this workflow always builds the same
  default VIDEO_URL, so there's no reason to re-download it every run.
- Extend test-autoplay.js to let muted autoplay run for a few seconds
  before clicking, then assert currentTime resets to near 0 after the
  click - regression coverage for the restart-on-reveal fix earlier in
  this PR.
@modem7 modem7 merged commit 70615fd into master Jul 9, 2026
4 checks passed
@modem7 modem7 deleted the fix/restart-on-reveal branch July 9, 2026 22:54
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.

video playback start

1 participant