Skip to content

Video: once metadata loads, seek every frozen video to 0 - #82

Merged
tmashara merged 2 commits into
mainfrom
claude/issue-74-video-seek
Oct 29, 2026
Merged

tmashara merged 2 commits into
mainfrom
claude/issue-74-video-seek

Conversation

@tmashara

Copy link
Copy Markdown
Owner

What

freezeVideo now seeks every frozen video to 0 once its metadata has loaded, played or not. A video that is still loading gets up to 2s for loadedmetadata (or error) first.

Why

A video's box takes the poster's aspect ratio until a seek runs after metadata, and the video's own ratio from then on. A seek before metadata (readyState 0) doesn't count. freezeVideo skipped every video that hadn't played, which under the play() stub was every video. So with height: auto, a page that seeked after metadata on one side and not on the other gave boxes of different heights (360px vs 400px in the new fixture). Seeking every loaded video after metadata makes both sides converge.

Behavior changes

  • Frozen videos whose metadata loads now show frame 0 instead of the poster. A video with a black or blank first frame now compares that instead of its designed poster. That's deterministic, but it's a visible change in shots.
  • Accepted diffs and --cache-right entries from earlier runs that contain video may no longer match. The version isn't bumped here, so cache keys stay the same.
  • A video that never loads metadata keeps its poster: no src, a 404 or unsupported source, or preload="none". Those are skipped without waiting. Only NETWORK_LOADING videos get the wait.

Bounded waits

Each freezeVideo call waits at most 2s for metadata, then at most 2s for seeked, per video. Videos run in parallel, so that's 4s per call worst case and 8s per load, since it runs twice. Page timers keep running under page.clock.install, the same as the existing 2s seek cap.

How tested

  • New guard rail video-seek: one poster video with height: auto. The left side seeks inside loadedmetadata, the right side sets currentTime = 0 at parse. On main it fails (exit 1, 80.37% diff on #v). With the change it passes, 3 runs out of 3.
  • Existing video guard rail is renamed to "stay on frame 0" and still has 0 diff.
  • npm run typecheck, npm run lint, npm run format:check, npm test (308 pass) and npm run test:visual (335 pass) all pass locally on macOS. No accept hashes were recorded.

Docs are updated where the poster behaviour was stated: README, how-it-works, the config JSDoc, the example config and the skill reference.

Fixes #74

🤖 Generated with Claude Code

tmashara and others added 2 commits October 29, 2026 18:44
A video whose page seeked after metadata lays out at the video's aspect
ratio; one that never did keeps the poster's. freezeVideo skipped every
unplayed video, so the two sides could differ. It now waits (up to 2s)
for metadata on a still-loading video and seeks every loaded one to 0.

Fixes #74

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmashara
tmashara merged commit cbbc656 into main Oct 29, 2026
3 checks passed
@tmashara
tmashara deleted the claude/issue-74-video-seek branch October 29, 2026 18:01
@tmashara tmashara mentioned this pull request Oct 29, 2026
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: after metadata, seek every video to 0, played or not

1 participant