瀏覽代碼

Move participant event handler to a platform generic location

j8
Bettenbuk Zoltan 6 年之前
父節點
當前提交
ce9744b9c3
共有 2 個文件被更改,包括 41 次插入17 次删除
  1. 0
    15
      conference.js
  2. 41
    2
      react/features/base/participants/middleware.js

+ 0
- 15
conference.js 查看文件

@@ -1919,21 +1919,6 @@ export default {
1919 1919
             JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
1920 1920
             (participant, name, oldValue, newValue) => {
1921 1921
                 switch (name) {
1922
-                case 'features_screen-sharing': {
1923
-                    APP.store.dispatch(participantUpdated({
1924
-                        conference: room,
1925
-                        id: participant.getId(),
1926
-                        features: { 'screen-sharing': true }
1927
-                    }));
1928
-                    break;
1929
-                }
1930
-                case 'raisedHand':
1931
-                    APP.store.dispatch(participantUpdated({
1932
-                        conference: room,
1933
-                        id: participant.getId(),
1934
-                        raisedHand: newValue === 'true'
1935
-                    }));
1936
-                    break;
1937 1922
                 case 'remoteControlSessionStatus':
1938 1923
                     APP.UI.setRemoteControlActiveStatus(
1939 1924
                         participant.getId(),

+ 41
- 2
react/features/base/participants/middleware.js 查看文件

@@ -1,14 +1,17 @@
1 1
 // @flow
2 2
 
3
+import UIEvents from '../../../../service/UI/UIEvents';
4
+
5
+import { CALLING, INVITED } from '../../presence-status';
6
+
3 7
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
4 8
 import {
5 9
     CONFERENCE_WILL_JOIN,
6 10
     forEachConference,
7 11
     getCurrentConference
8 12
 } from '../conference';
9
-import { CALLING, INVITED } from '../../presence-status';
13
+import { JitsiConferenceEvents } from '../lib-jitsi-meet';
10 14
 import { MiddlewareRegistry, StateListenerRegistry } from '../redux';
11
-import UIEvents from '../../../../service/UI/UIEvents';
12 15
 import { playSound, registerSound, unregisterSound } from '../sounds';
13 16
 
14 17
 import {
@@ -185,6 +188,42 @@ StateListenerRegistry.register(
185 188
                 localParticipantIdChanged(LOCAL_PARTICIPANT_DEFAULT_ID));
186 189
     });
187 190
 
191
+/**
192
+ * Registers listeners for participant change events.
193
+ */
194
+StateListenerRegistry.register(
195
+    state => state['features/base/conference'].conference,
196
+    (conference, { dispatch }) => {
197
+        if (conference) {
198
+            // We joined a conference
199
+            conference.on(
200
+                JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
201
+                (participant, propertyName, oldValue, newValue) => {
202
+                    switch (propertyName) {
203
+                    case 'features_screen-sharing':
204
+                        store.dispatch(participantUpdated({
205
+                            conference,
206
+                            id: participant.getId(),
207
+                            features: { 'screen-sharing': true }
208
+                        }));
209
+                        break;
210
+                    case 'raisedHand':
211
+                        dispatch(participantUpdated({
212
+                            conference,
213
+                            id: participant.getId(),
214
+                            raisedHand: newValue === 'true'
215
+                        }));
216
+                        break;
217
+                    default:
218
+
219
+                        // Ignore for now.
220
+                    }
221
+
222
+                });
223
+        }
224
+    }
225
+);
226
+
188 227
 /**
189 228
  * Initializes the local participant and signals that it joined.
190 229
  *

Loading…
取消
儲存