fix(web): disable adaptiveStream so screen-share video isn't paused#29
Merged
Conversation
Web SFU viewers got the host's audio but a black screen for the screen share. The room was created with adaptiveStream:true, which pauses video tracks that livekit doesn't see attached to a visible element via track.attach(). The viewer renders through a manually built MediaStream on a <video> srcObject, so livekit never registers the element and paused the video at the SFU — audio (unaffected by adaptiveStream) kept flowing, video stayed black. Disable adaptiveStream: the viewer always shows the single presenter stream, so there's nothing to adaptively pause. (Pairs with the prior fresh-MediaStream -reference fix so Firefox actually re-binds srcObject when the video arrives.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
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
Web SFU viewers got the host's audio but a black screen for the screen share (even after the fresh-MediaStream-reference fix #28 deployed).
Root cause
useWebRTCSFUcreates the Room withadaptiveStream: true. adaptiveStream pauses video tracks that livekit doesn't see attached to a visible element viatrack.attach(). This code renders through a manually built MediaStream on a<video>srcObject (it never callstrack.attach), so livekit saw no visible element and paused the screen-share video at the SFU. Audio is unaffected by adaptiveStream → audio played, video stayed black. (The Chrome egress uses its own subscription, which is why the composite/restream was always fine.)Fix
adaptiveStream: false. The viewer always shows the single presenter stream, so there's nothing to adaptively pause. Pairs with #28 (fresh MediaStream reference) so Firefox re-bindssrcObjectwhen the video arrives.Test
Assert the Room is constructed with
adaptiveStream: false; existing track-merge test still passes. Lint clean.🤖 Generated with Claude Code