fix: restore camera when screen-picker is canceled#272
Merged
JohnMcLear merged 1 commit intomainfrom May 1, 2026
Merged
Conversation
Clicking the screenshare button calls getDisplayMedia(). If the user clicks Cancel in the OS picker (or denies permission), getDisplayMedia rejects with NotAllowedError. The previous handler unconditionally flipped the camera button to off BEFORE awaiting getDisplayMedia, and when the picker was canceled the rejected screenshare path left the camera button stuck off — with a stale, disabled camera track still sitting in the local stream. The user saw 'no video' even though the camera was previously running. Capture the camera's previous state, attempt screenshare, and if screenshare didn't take AND the camera was on before, re-enable the camera button + run updateLocalTracks again to restore live video. Includes a regression test in static/tests/frontend-new/specs/screenshare.spec.ts that stubs getDisplayMedia to throw NotAllowedError, clicks the screenshare button, and asserts both the button state AND the underlying video track end up live + enabled. Also covers the case where the camera was off before the click — both buttons stay off in that case (we don't auto-enable a camera the user explicitly turned off). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
Author
|
/review |
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
1 similar comment
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
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.
Summary
Clicking the screenshare button when the camera is on, then clicking Cancel in the OS screen-picker, used to leave the user with no video at all (camera button stuck off, stale disabled camera track in the local stream).
Bug
addAsyncEventHandlers($screenshareBtn, ...)instatic/js/index.jsdid:If
getDisplayMediarejects (user clicks Cancel →NotAllowedError, or browser denies):updateLocalTracksflipsscreenshare.enabledback to false._localTracks.streamis now disabled (loop on line 692-694 setstrack.enabled = video.enabledwhich isfalse).livebut disabled).Fix
Capture the camera's previous state. After
updateLocalTracks, if the user wanted to enable screenshare and screenshare didn't take and the camera was on before, re-enable the camera button and callupdateLocalTracks({updateVideo: true})once more so the camera track ends up enabled + live again.Test
New
static/tests/frontend-new/specs/screenshare.spec.ts:getDisplayMediato throwNotAllowedError→ click screenshare → assert camera button on, screenshare button off, video track live + enabled.Couldn't run locally — my etherpad-lite checkout is on a feature branch whose
playwright.config.tsdoesn't auto-discover plugin specs. CI on develop has the right test-match config.Semver: patch
Bug fix.
Test plan
screenshare.spec.tspasses (2 cases) and existing suite stays green🤖 Generated with Claude Code