Skip to content

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

Move participant event handler to a platform generic location

Bettenbuk Zoltance9744b9c356
diff --git a/conference.js b/conference.js
index c1b9995664..d6fdecf3d2 100644
--- a/conference.js
+++ b/conference.js
@@ -1919,21 +1919,6 @@ export default {
JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
(participant, name, oldValue, newValue) => {
switch (name) {
- case 'features_screen-sharing': {
- APP.store.dispatch(participantUpdated({
- conference: room,
- id: participant.getId(),
- features: { 'screen-sharing': true }
- }));
- break;
- }
- case 'raisedHand':
- APP.store.dispatch(participantUpdated({
- conference: room,
- id: participant.getId(),
- raisedHand: newValue === 'true'
- }));
- break;
case 'remoteControlSessionStatus':
APP.UI.setRemoteControlActiveStatus(
participant.getId(),
diff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.js
index f53ee2458c..7f43f5e097 100644
--- a/react/features/base/participants/middleware.js
+++ b/react/features/base/participants/middleware.js
@@ -1,14 +1,17 @@
// @flow
+import UIEvents from '../../../../service/UI/UIEvents';
+
+import { CALLING, INVITED } from '../../presence-status';
+
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
import {
CONFERENCE_WILL_JOIN,
forEachConference,
getCurrentConference
} from '../conference';
-import { CALLING, INVITED } from '../../presence-status';
+import { JitsiConferenceEvents } from '../lib-jitsi-meet';
import { MiddlewareRegistry, StateListenerRegistry } from '../redux';
-import UIEvents from '../../../../service/UI/UIEvents';
import { playSound, registerSound, unregisterSound } from '../sounds';
import {
@@ -185,6 +188,42 @@ StateListenerRegistry.register(
localParticipantIdChanged(LOCAL_PARTICIPANT_DEFAULT_ID));
});
+/**
+ * Registers listeners for participant change events.
+ */
+StateListenerRegistry.register(
+ state => state['features/base/conference'].conference,
+ (conference, { dispatch }) => {
+ if (conference) {
+ // We joined a conference
+ conference.on(
+ JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
+ (participant, propertyName, oldValue, newValue) => {
+ switch (propertyName) {
+ case 'features_screen-sharing':
+ store.dispatch(participantUpdated({
+ conference,
+ id: participant.getId(),
+ features: { 'screen-sharing': true }
+ }));
+ break;
+ case 'raisedHand':
+ dispatch(participantUpdated({
+ conference,
+ id: participant.getId(),
+ raisedHand: newValue === 'true'
+ }));
+ break;
+ default:
+
+ // Ignore for now.
+ }
+
+ });
+ }
+ }
+);
+
/**
* Initializes the local participant and signals that it joined.
*