Skip to content

fix(capture): apply device viewport before tab-capture starts#808

Closed
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/critical-bug-investigation-cb6b
Closed

fix(capture): apply device viewport before tab-capture starts#808
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/critical-bug-investigation-cb6b

Conversation

@cursor

@cursor cursor Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

#803 starts extension tab-capture before goto runs so load animations are recorded from t=0. Tab-capture constraints pin exact minWidth/minHeight from the target device viewport, but the page still had the browser's default viewport until navigation.

Concrete trigger: browser spawned with default Macbook Pro 13 (1280×800 @2x → 2560×1600 device px), capture called with device: 'iPhone 13' (390×844 @3x → 1170×2532 device px). getUserMedia fails with OverconstrainedError (minHeight: 2532 > tab height 1600) before navigation even begins — a hard failure for any cross-device capture.

Root cause

create-capture.js resolved the target viewport via goto.getDevice() but never applied it with page.setViewport() before extension.startRecording(). The ffmpeg-based modes (screencast/screenshot) already set the viewport in recorder/index.js; the default extension path did not.

Fix

Rename resolveViewportprepareViewport and call page.setViewport(device.viewport) before recording starts. Navigation still runs after recording begins (unchanged #803 behaviour).

Validation

  • Added regression test: applies the target device viewport before recording starts
  • All 38 @browserless/capture tests pass
Open in Web View Automation 

#803 starts recording before goto runs, but tab-capture constraints pin exact width/height from the target device. When the page still has the browser default viewport but capture requests a different device, getUserMedia fails with OverconstrainedError because minHeight exceeds the tab height.

Apply the resolved device viewport via page.setViewport before starting the recorder so constraints always match the tab, while still beginning recording before navigation.
@Kikobeats Kikobeats closed this Jun 26, 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.

2 participants