Don't update mute when reaching the user count threshold. (#2474)
* Dont update mute during call.
This commit is contained in:
@@ -80,17 +80,12 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
const memberships = useMatrixRTCSessionMemberships(rtcSession);
|
const memberships = useMatrixRTCSessionMemberships(rtcSession);
|
||||||
const isJoined = useMatrixRTCSessionJoinState(rtcSession);
|
const isJoined = useMatrixRTCSessionJoinState(rtcSession);
|
||||||
|
|
||||||
// The mute state reactively gets updated once the participant count reaches the threshold.
|
// This should use `useEffectEvent` (only available in experimental versions)
|
||||||
// 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(() => {
|
useEffect(() => {
|
||||||
if (autoMuteHappened.current) return;
|
if (memberships.length >= MUTE_PARTICIPANT_COUNT)
|
||||||
if (memberships.length >= MUTE_PARTICIPANT_COUNT) {
|
|
||||||
muteStates.audio.setEnabled?.(false);
|
muteStates.audio.setEnabled?.(false);
|
||||||
autoMuteHappened.current = true;
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}
|
}, []);
|
||||||
}, [autoMuteHappened, memberships, muteStates.audio]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.rtcSession = rtcSession;
|
window.rtcSession = rtcSession;
|
||||||
|
|||||||
Reference in New Issue
Block a user