From c89791069b9938e3724e8afaabee28dc57f8f7d1 Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Fri, 11 May 2018 10:34:39 -0700 Subject: [PATCH] fix(large-video): do not reselect video on self dominant speaker In the current middleware logic, when the local participant becomes dominant speaker, a new participant can be selected to receive high quality video from. This means large-video could potentially do a switch to another participant when the local participant becomes dominant speaker. Prevent such behavior. --- react/features/large-video/middleware.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/react/features/large-video/middleware.js b/react/features/large-video/middleware.js index 7840e2cee..60115dbe1 100644 --- a/react/features/large-video/middleware.js +++ b/react/features/large-video/middleware.js @@ -4,7 +4,8 @@ import { DOMINANT_SPEAKER_CHANGED, PARTICIPANT_JOINED, PARTICIPANT_LEFT, - PIN_PARTICIPANT + PIN_PARTICIPANT, + getLocalParticipant } from '../base/participants'; import { MiddlewareRegistry } from '../base/redux'; import { @@ -27,7 +28,16 @@ MiddlewareRegistry.register(store => next => action => { const result = next(action); switch (action.type) { - case DOMINANT_SPEAKER_CHANGED: + case DOMINANT_SPEAKER_CHANGED: { + const localParticipant = getLocalParticipant(store.getState()); + + if (localParticipant && localParticipant.id !== action.participant.id) { + store.dispatch(selectParticipantInLargeVideo()); + } + + break; + } + case PARTICIPANT_JOINED: case PARTICIPANT_LEFT: case PIN_PARTICIPANT: