Fix black screen: subscribe to Media Gateway streams via live mode#2
Open
jajajhhz wants to merge 2 commits into
Open
Fix black screen: subscribe to Media Gateway streams via live mode#2jajajhhz wants to merge 2 commits into
jajajhhz wants to merge 2 commits into
Conversation
The viewer hardcoded createClient({ mode: 'rtc' }). Streams injected by
Agora Media Gateway (RTMP/SRT ingest, e.g. the deviceShifu cameras) join
the channel as live-broadcast hosts, which an rtc/communication-mode
client cannot see — so remoteUsers stays 0 and the page renders black.
Switch to live-broadcast mode and set the client role before joining
(audience for viewers, host for publishers) so the viewer subscribes to
the camera's video track.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A string uid (e.g. from a URL query param) makes the SDK join in user-account mode, where the client does not receive the Media Gateway host's published stream — another cause of the black screen. Join with an integer uid when the value is numeric. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
The
/videoviewer connects to the channel and authenticates, but renders a black screen — the console shows🔄 Remote users updated: 0indefinitely; it never sees the camera.Root cause
agora-config.tshard-codes the client asmode: 'rtc'(communication profile). But the SS Rover cameras are pushed into Agora via Media Gateway (RTMPrtls-ingress/ SRT), which join the channel as live-broadcast hosts. An rtc/communication-mode client cannot subscribe to live-broadcast hosts, soremoteUsersstays empty and nothing renders.Verified against the live
ssroverchannel: the camera (uid1001) is broadcasting (confirmed via the Agora REST channel API), the viewer joins successfully, but logsRemote users updated: 0.Fix
livemode.setClientRole(audience | host)beforejoin()(viewers = audience, publishers = host), which live mode requires.Minimal behavioural change; no API/prop changes. The publisher path keeps working (joins as host).
Test
After deploy, open:
→ the viewer should now subscribe to uid
1001and show the camera feed.🤖 Generated with Claude Code