-
Notifications
You must be signed in to change notification settings - Fork 39
fix: viewer livestream muting issue in SDK #1882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# Conflicts: # packages/react-native-sdk/src/components/Livestream/LivestreamControls/ViewerLivestreamControls.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes audio muting issues in the livestream viewer by changing how audio control works and improves video dimension tracking for better layout handling.
- Audio muting now controls the volume of the dominant speaker's audio track directly instead of using InCallManager for speakerphone control
- Video dimension tracking is improved using a new hook-based approach that tracks dimensions per participant and track type
- Sample app is simplified by removing manual call object creation and management
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| ViewLiveStream.tsx | Simplifies component by removing manual call creation and directly rendering LivestreamPlayer |
| LivestreamLayout.tsx | Replaces stats-based dimension tracking with hook-based approach and adds objectFit to all VideoRenderer instances |
| ViewerLivestreamControls.tsx | Changes audio muting from InCallManager speakerphone control to direct audio track volume manipulation |
...s/react-native-sdk/src/components/Livestream/LivestreamControls/ViewerLivestreamControls.tsx
Outdated
Show resolved
Hide resolved
...s/react-native-sdk/src/components/Livestream/LivestreamControls/ViewerLivestreamControls.tsx
Outdated
Show resolved
Hide resolved
packages/react-native-sdk/src/components/Livestream/LivestreamLayout/LivestreamLayout.tsx
Show resolved
Hide resolved
| const audioTrack = dominantSpeaker?.audioStream?.getAudioTracks?.()[0]; | ||
| const shouldMute = !isMuted; | ||
| if (shouldMute) { | ||
| // @ts-expect-error - _setVolume is a private method of MediaStreamTrack in rn-webrtc | ||
| audioTrack?._setVolume(0); | ||
| } else { | ||
| // @ts-expect-error -_setVolume is a private method of MediaStreamTrack in rn-webrtc | ||
| audioTrack?._setVolume(0.75); | ||
| } | ||
| setIsMuted(shouldMute); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assumes that there is only one presenter. In case there are multiple, the behavior of this code is non-deterministic.
For example:
- At the moment of mute, A was the dominant speaker
- At the moment of unmute, B is the dominant speaker
In this case, A will stay forever muted, and B will always be audible.
We need to either:
- Mute audio on system level
- Mute all available audio tracks, individually
|
this fix will be included in #1840 as new audio manager is required for system level mute |
💡 Overview
This pull request updates the livestream viewer and layout components to improve audio muting and video dimension handling, while simplifying the way livestream calls are rendered in the sample app. The most important changes are grouped below:
Audio Muting Logic Improvements:
ViewerLivestreamControlscomponent now mutes/unmutes the dominant speaker's audio by adjusting the audio track volume directly, instead of toggling the speakerphone viaInCallManager. This provides more precise control over audio muting in livestreams. [1] [2] [3]Livestream Layout and Video Dimension Handling:
LivestreamLayoutcomponent now uses a newVideoTrackDimensionsRenderLessComponentthat leverages theuseTrackDimensionshook to accurately track and update video dimensions for both the presenter (during screen share) and the current speaker. This replaces the previous approach based on call stats reports. [1] [2] [3] [4]objectFitproperty onVideoRendererhas been simplified, and the property is now consistently passed for both presenter and current speaker video tracks. [1] [2]Sample App Simplification:
ViewLiveStreamChildrencomponent no longer manually creates and manages the call object, and instead directly renders theLivestreamPlayercomponent, reducing complexity.