Skip to content

Commit

Permalink
Dont update mute during call.
Browse files Browse the repository at this point in the history
  • Loading branch information
toger5 committed Jul 10, 2024
1 parent c40ea35 commit 55e57bc
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/room/GroupCallView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,12 @@ export const GroupCallView: FC<Props> = ({
const memberships = useMatrixRTCSessionMemberships(rtcSession);
const isJoined = useMatrixRTCSessionJoinState(rtcSession);

// The mute state reactively gets updated once the participant count reaches the threshold.
// The user then still is able to unmute again.
// The more common case is that the user is muted from the start (participant count is already over the threshold).
const autoMuteHappened = useRef(false);
useEffect(() => {
if (autoMuteHappened.current) return;
if (memberships.length >= MUTE_PARTICIPANT_COUNT) {
const participantMuteOnce = useCallback(() => {
if (memberships.length >= MUTE_PARTICIPANT_COUNT)
muteStates.audio.setEnabled?.(false);
autoMuteHappened.current = true;
}
}, [autoMuteHappened, memberships, muteStates.audio]);
}, [memberships.length, muteStates.audio]);

useEffect(() => participantMuteOnce(), [participantMuteOnce]);

useEffect(() => {
window.rtcSession = rtcSession;
Expand Down

0 comments on commit 55e57bc

Please sign in to comment.