fix(dominant-speaker): Lower hand through xmpp for dominant speaker (#10220)

This commit is contained in:
Horatiu Muresan 2021-10-21 17:52:22 +03:00 committed by GitHub
parent 162ec5a2b2
commit 2cfa5f6312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 17 deletions

View File

@ -60,6 +60,8 @@ import {
} from './functions'; } from './functions';
import { PARTICIPANT_JOINED_FILE, PARTICIPANT_LEFT_FILE } from './sounds'; import { PARTICIPANT_JOINED_FILE, PARTICIPANT_LEFT_FILE } from './sounds';
import { hasRaisedHand, raiseHand } from '.';
declare var APP: Object; declare var APP: Object;
/** /**
@ -86,27 +88,14 @@ MiddlewareRegistry.register(store => next => action => {
break; break;
case DOMINANT_SPEAKER_CHANGED: { case DOMINANT_SPEAKER_CHANGED: {
// Ensure the raised hand state is cleared for the dominant speaker // Lower hand through xmpp when local participant becomes dominant speaker.
// and only if it was set when this is the local participant const { id } = action.participant;
const { conference, id } = action.participant;
const state = store.getState(); const state = store.getState();
const participant = getLocalParticipant(state); const participant = getLocalParticipant(state);
const isLocal = participant && participant.id === id; const isLocal = participant && participant.id === id;
if (isLocal && participant.raisedHandTimestamp === undefined) { if (isLocal && hasRaisedHand(participant) && !getDisableRemoveRaisedHandOnFocus(state)) {
// if local was undefined, let's leave it like that store.dispatch(raiseHand(false));
// avoids sending unnecessary presence updates
break;
}
if (!getDisableRemoveRaisedHandOnFocus(state)) {
participant && store.dispatch(participantUpdated({
conference,
id,
local: isLocal,
raisedHandTimestamp: 0
}));
} }
break; break;