Skip to content

Conversation

@santhoshvai
Copy link
Member

@santhoshvai santhoshvai commented Aug 8, 2025

💡 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:

  • The ViewerLivestreamControls component now mutes/unmutes the dominant speaker's audio by adjusting the audio track volume directly, instead of toggling the speakerphone via InCallManager. This provides more precise control over audio muting in livestreams. [1] [2] [3]

Livestream Layout and Video Dimension Handling:

  • The LivestreamLayout component now uses a new VideoTrackDimensionsRenderLessComponent that leverages the useTrackDimensions hook 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]
  • The logic for setting the objectFit property on VideoRenderer has been simplified, and the property is now consistently passed for both presenter and current speaker video tracks. [1] [2]

Sample App Simplification:

  • The sample app's ViewLiveStreamChildren component no longer manually creates and manages the call object, and instead directly renders the LivestreamPlayer component, reducing complexity.

# Conflicts:
#	packages/react-native-sdk/src/components/Livestream/LivestreamControls/ViewerLivestreamControls.tsx
@santhoshvai santhoshvai self-assigned this Aug 8, 2025
Copy link
Contributor

Copilot AI left a 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

@santhoshvai santhoshvai requested a review from oliverlaz August 8, 2025 15:42
Comment on lines +110 to +119
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);
Copy link
Member

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

@santhoshvai santhoshvai marked this pull request as draft August 18, 2025 14:17
@santhoshvai
Copy link
Member Author

this fix will be included in #1840 as new audio manager is required for system level mute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants