Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ref(video-layout): updates connection status when redux updates

Leonard Kimec0439cbb183
diff --git a/conference.js b/conference.js
index 7b7f308cec..25620a1b04 100644
--- a/conference.js
+++ b/conference.js
@@ -1798,12 +1798,9 @@ export default {
room.on(
JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
- (id, connectionStatus) => {
- APP.store.dispatch(participantConnectionStatusChanged(
- id, connectionStatus));
+ (id, connectionStatus) => APP.store.dispatch(
+ participantConnectionStatusChanged(id, connectionStatus)));
- APP.UI.participantConnectionStatusChanged(id);
- });
room.on(
JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED,
id => APP.store.dispatch(dominantSpeakerChanged(id, room)));
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index dcb4afdb42..401b4c0be9 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -826,15 +826,6 @@ UI.handleLastNEndpoints = function(leavingIds, enteringIds) {
VideoLayout.onLastNEndpointsChanged(leavingIds, enteringIds);
};
-/**
- * Will handle notification about participant's connectivity status change.
- *
- * @param {string} id the id of remote participant(MUC jid)
- */
-UI.participantConnectionStatusChanged = function(id) {
- VideoLayout.onParticipantConnectionStatusChanged(id);
-};
-
/**
* Prompt user for nickname.
*/
diff --git a/react/features/video-layout/middleware.web.js b/react/features/video-layout/middleware.web.js
index 758009e3df..00ec129fc4 100644
--- a/react/features/video-layout/middleware.web.js
+++ b/react/features/video-layout/middleware.web.js
@@ -5,6 +5,7 @@ import UIEvents from '../../../service/UI/UIEvents';
import {
DOMINANT_SPEAKER_CHANGED,
+ PARTICIPANT_UPDATED,
PIN_PARTICIPANT
} from '../base/participants';
import { MiddlewareRegistry } from '../base/redux';
@@ -26,6 +27,18 @@ MiddlewareRegistry.register(store => next => action => {
const result = next(action);
switch (action.type) {
+
+ case PARTICIPANT_UPDATED: {
+ // Look for actions that triggered a change to connectionStatus. This is
+ // done instead of changing the connection status change action to be
+ // explicit in order to minimize changes to other code.
+ if (typeof action.participant.connectionStatus !== 'undefined') {
+ VideoLayout.onParticipantConnectionStatusChanged(
+ action.participant.id);
+ }
+ break;
+ }
+
case DOMINANT_SPEAKER_CHANGED:
VideoLayout.onDominantSpeakerChanged(action.participant.id);
break;