Skip to content

fix(media): smooth demo playback — video on the site, fast-decode webp in the README#444

Merged
rejifald merged 1 commit into
mainfrom
worktree-demo-smoothness
Jul 4, 2026
Merged

fix(media): smooth demo playback — video on the site, fast-decode webp in the README#444
rejifald merged 1 commit into
mainfrom
worktree-demo-smoothness

Conversation

@rejifald

@rejifald rejifald commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Problem

The demo embeds started smooth and turned progressively choppy — on the docs homepage and in the README. Animated-webp frames are delta-encoded, so a browser that falls behind cannot skip frames; our embeds were lossless 2560×1440 @ 15 fps (the slowest decode path), so decode lag compounded over the loop. Retina screens (picking the @2x file) were hit hardest.

Fix

  • Site: <DemoMedia /> is now a <video> over a new committed demo[-dark]-clip.mp4 pair (marquee cut, 617/549 KB) — hardware-decoded, drops frames natively, cannot accumulate lag. Only the active theme's video mounts (MutationObserver on .dark — a hidden video would still download + decode). Verified playing on the homepage (playing: true). The clip pair doubles as the parked ~20 s X-post cut.
  • README (GitHub can't embed repo-hosted video, so an animated image is forced): embed webps re-encoded lossy q90 @ 12 fps — several-times-faster decode at visually-equivalent quality (q85 showed faint background mottling at 1:1; q90 is clean), and half the bytes: 871/816 KB (1x), 1.9/1.8 MB (@2x).

Freshness gate, copy step, gitignore negations, and docs/media/README.md updated; encodeMp4 gained a crf parameter and encodeWebp fps/quality options. Squash-merge to keep asset generations out of main's history.

🤖 Generated with Claude Code

…p in the README

The embeds turned progressively choppy: animated-webp frames are
delta-encoded, so a browser that falls behind cannot skip ahead, and our
lossless 2560×1440@15fps files were the slowest possible decode — the
lag compounds over the loop. Two-pronged fix:

- Site: <DemoMedia /> is now a <video> over a new committed
  demo[-dark]-clip.mp4 pair (marquee cut, ~600 KB each) — hardware
  decode, native frame dropping; only the active theme's video mounts
  (MutationObserver on .dark; a display:none video would still decode).
  The clip pair doubles as the X-post cut.
- README (GitHub can't embed repo-hosted video): embed webps re-encoded
  lossy q90 @ 12 fps — several-times-faster decode, visually equivalent
  on this content, and half the bytes (871/816 KB 1x, 1.9/1.8 MB @2x).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rejifald rejifald merged commit 5c5e94b into main Jul 4, 2026
12 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