Skip to content

fix(capture): apply device viewport before recording starts#809

Closed
Kikobeats wants to merge 1 commit into
masterfrom
fix-capture-viewport
Closed

fix(capture): apply device viewport before recording starts#809
Kikobeats wants to merge 1 commit into
masterfrom
fix-capture-viewport

Conversation

@Kikobeats

@Kikobeats Kikobeats commented Jun 26, 2026

Copy link
Copy Markdown
Member

Tab capture pins exact width/height from the target device, so getUserMedia overconstrains and fails with OverconstrainedError when the page still has the browser's default viewport. resolveViewport computed the device viewport but never applied it before the extension mode started recording.

Rename to prepareViewport and page.setViewport(device.viewport) before any mode starts, so the page always matches the constraints. Navigation still runs after recording starts, so load animations are captured from t=0. This centralizes the viewport application for all modes, making the frame recorder's own setViewport redundant.


Note

Low Risk
Small, localized change to capture startup ordering with a new regression test; no auth or data-path impact.

Overview
Fixes extension tab capture failing with OverconstrainedError when a custom device/viewport does not match the page’s default size. Tab capture’s getUserMedia constraints are pinned to the target device dimensions, so the page must already use that viewport before START_RECORDING runs.

prepareViewport (renamed from resolveViewport) is now async and calls page.setViewport(device.viewport) in create-capture for all capture modes before any recorder starts. The frame recorder no longer applies the viewport itself (comments updated to reflect centralization). Navigation still begins after recording starts so load animations are captured from t=0.

Adds a test that asserts the device viewport is set at START_RECORDING time.

Reviewed by Cursor Bugbot for commit b28298e. Bugbot is set up for automated code reviews on this repo. Configure here.

Tab capture pins exact width/height from the target device, so
`getUserMedia` overconstrains and fails with OverconstrainedError when
the page still has the browser's default viewport. `resolveViewport`
computed the device viewport but never applied it before the extension
mode started recording.

Rename to `prepareViewport` and `page.setViewport(device.viewport)`
before any mode starts, so the page always matches the constraints.
Navigation still runs after recording starts, so load animations are
captured from t=0. This centralizes the viewport application for all
modes, making the frame recorder's own setViewport redundant.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Kikobeats Kikobeats closed this Jun 26, 2026
@Kikobeats Kikobeats deleted the fix-capture-viewport branch June 26, 2026 07:21
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