fix(capture): apply device viewport before tab-capture starts#808
Closed
cursor[bot] wants to merge 1 commit into
Closed
fix(capture): apply device viewport before tab-capture starts#808cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
#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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug and impact
#803starts extension tab-capture beforegotoruns so load animations are recorded from t=0. Tab-capture constraints pin exactminWidth/minHeightfrom 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 withdevice: 'iPhone 13'(390×844 @3x → 1170×2532 device px).getUserMediafails withOverconstrainedError(minHeight: 2532> tab height 1600) before navigation even begins — a hard failure for any cross-device capture.Root cause
create-capture.jsresolved the target viewport viagoto.getDevice()but never applied it withpage.setViewport()beforeextension.startRecording(). The ffmpeg-based modes (screencast/screenshot) already set the viewport inrecorder/index.js; the default extension path did not.Fix
Rename
resolveViewport→prepareViewportand callpage.setViewport(device.viewport)before recording starts. Navigation still runs after recording begins (unchanged#803behaviour).Validation
applies the target device viewport before recording starts@browserless/capturetests pass