Skip to content

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

feat(speaker-status): update speaker status in redux

Leonard Kim955542f4a5e0
diff --git a/conference.js b/conference.js
index baa9d3bc68..d3d0759f15 100644
--- a/conference.js
+++ b/conference.js
@@ -35,8 +35,10 @@ import {
} from './react/features/base/lib-jitsi-meet';
import { setVideoAvailable } from './react/features/base/media';
import {
+ localParticipantConnectionStatusChanged,
localParticipantRoleChanged,
MAX_DISPLAY_NAME_LENGTH,
+ participantConnectionStatusChanged,
participantJoined,
participantLeft,
participantRoleChanged,
@@ -56,6 +58,8 @@ import {
} from './react/features/overlay';
import { showDesktopSharingButton } from './react/features/toolbox';
+const { participantConnectionStatus } = JitsiMeetJS.constants;
+
const ConnectionEvents = JitsiMeetJS.events.connection;
const ConnectionErrors = JitsiMeetJS.errors.connection;
@@ -1542,7 +1546,10 @@ export default {
room.on(
ConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
- id => {
+ (id, connectionStatus) => {
+ APP.store.dispatch(participantConnectionStatusChanged(
+ id, connectionStatus));
+
APP.UI.participantConnectionStatusChanged(id);
});
room.on(ConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => {
@@ -1636,10 +1643,16 @@ export default {
}
room.on(ConferenceEvents.CONNECTION_INTERRUPTED, () => {
+ APP.store.dispatch(localParticipantConnectionStatusChanged(
+ participantConnectionStatus.INTERRUPTED));
+
APP.UI.showLocalConnectionInterrupted(true);
});
room.on(ConferenceEvents.CONNECTION_RESTORED, () => {
+ APP.store.dispatch(localParticipantConnectionStatusChanged(
+ participantConnectionStatus.ACTIVE));
+
APP.UI.showLocalConnectionInterrupted(false);
});
diff --git a/react/features/base/participants/actions.js b/react/features/base/participants/actions.js
index d8f9bd80fb..3a53ddc3e4 100644
--- a/react/features/base/participants/actions.js
+++ b/react/features/base/participants/actions.js
@@ -30,6 +30,26 @@ export function dominantSpeakerChanged(id) {
};
}
+/**
+ * Creates an action to signal the connection status of the local participant
+ * has changed.
+ *
+ * @param {string} connectionStatus - The current connection status of the local
+ * participant, as enumerated by the library's participantConnectionStatus
+ * constants.
+ * @returns {Function}
+ */
+export function localParticipantConnectionStatusChanged(connectionStatus) {
+ return (dispatch, getState) => {
+ const participant = getLocalParticipant(getState);
+
+ if (participant) {
+ return dispatch(participantConnectionStatusChanged(
+ participant.id, connectionStatus));
+ }
+ };
+}
+
/**
* Action to signal that the ID of local participant has changed. It happens
* when the local participant joins a new conference or leaves an existing