Skip to content

fix(browser-actions): stop padding video recorded above the viewport size - #2555

Merged
chubes4 merged 1 commit into
mainfrom
fix/issue-2552-wp-codebox
Oct 2, 2026
Merged

chubes4 merged 1 commit into
mainfrom
fix/issue-2552-wp-codebox

Conversation

@chubes4

@chubes4 chubes4 commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2552.

Playwright's recorder captures at CSS-viewport pixels and pads any larger recordVideo.size with gray. #2549 defaulted the size to viewport × device-scale-factor, so viewport=432x768 device-scale-factor=2.5 produced a 1080x1920 WebM with the page in the top-left 432x768 corner. The summary also claimed a resolution the content didn't have.

This takes the issue's second option:

  • The default recording size is the CSS viewport. There's no device-scale multiplication, so no padding.
  • An explicit video-size is still honored, capped at 8,294,400 px. The README now says the recorder can only scale down, and that a higher-resolution output should be upscaled by an encoder afterwards.
  • video.width/height in the summary match the real content.

(Capturing true device-pixel frames via CDP Page.startScreencast is the other option in the issue and would be a separate, larger change.)

Tests

npm run build clean. test:browser-video-capture 4/4, including a rewritten high-DPR test that records a full-bleed blue page at 430x932 @2.5 and asserts:

  • the summary reports 430x932
  • the bottom-right pixel of a decoded frame is page content (blue), not padding

The pixel is read with ffmpeg (PATH, FFMPEG_PATH, or Playwright's bundled ffmpeg), and the check is skipped with a diagnostic if none is available. The cook's original version decoded the WebM inside headless Chromium from a data: URL, but loadeddata never fires there, so the test hung indefinitely.

Also passing: presentation 2/2 + 1/1, annotations 2/2, browser-preview-routing 16/16.

Process note

Drafted by a Homeboy cook (cook-detached-764926ec). Its candidate didn't compile: three call sites still passed the removed scale argument, and the new test hung. With Chris's authorization it was corrected and re-verified by Extra Chill Bot and published outside Homeboy.

AI-assisted: drafted by an OpenCode agent, corrected and finalized by Extra Chill Bot.

@chubes4
chubes4 merged commit 6d54f09 into main Oct 2, 2026
5 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.

browser-actions video-size larger than the viewport pads instead of rendering at device scale (#2549 regression)

1 participant