Explorar el Código

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

The speakerStatus field already exists as part of the objects
in the participant reducer. When the library updates the
connection status of a user, plumb that update through to redux.
j8
Leonard Kim hace 8 años
padre
commit
955542f4a5
Se han modificado 2 ficheros con 34 adiciones y 1 borrados
  1. 14
    1
      conference.js
  2. 20
    0
      react/features/base/participants/actions.js

+ 14
- 1
conference.js Ver fichero

35
 } from './react/features/base/lib-jitsi-meet';
35
 } from './react/features/base/lib-jitsi-meet';
36
 import { setVideoAvailable } from './react/features/base/media';
36
 import { setVideoAvailable } from './react/features/base/media';
37
 import {
37
 import {
38
+    localParticipantConnectionStatusChanged,
38
     localParticipantRoleChanged,
39
     localParticipantRoleChanged,
39
     MAX_DISPLAY_NAME_LENGTH,
40
     MAX_DISPLAY_NAME_LENGTH,
41
+    participantConnectionStatusChanged,
40
     participantJoined,
42
     participantJoined,
41
     participantLeft,
43
     participantLeft,
42
     participantRoleChanged,
44
     participantRoleChanged,
56
 } from './react/features/overlay';
58
 } from './react/features/overlay';
57
 import { showDesktopSharingButton } from './react/features/toolbox';
59
 import { showDesktopSharingButton } from './react/features/toolbox';
58
 
60
 
61
+const { participantConnectionStatus } = JitsiMeetJS.constants;
62
+
59
 const ConnectionEvents = JitsiMeetJS.events.connection;
63
 const ConnectionEvents = JitsiMeetJS.events.connection;
60
 const ConnectionErrors = JitsiMeetJS.errors.connection;
64
 const ConnectionErrors = JitsiMeetJS.errors.connection;
61
 
65
 
1542
 
1546
 
1543
         room.on(
1547
         room.on(
1544
             ConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
1548
             ConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
1545
-            id => {
1549
+            (id, connectionStatus) => {
1550
+                APP.store.dispatch(participantConnectionStatusChanged(
1551
+                    id, connectionStatus));
1552
+
1546
                 APP.UI.participantConnectionStatusChanged(id);
1553
                 APP.UI.participantConnectionStatusChanged(id);
1547
         });
1554
         });
1548
         room.on(ConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => {
1555
         room.on(ConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => {
1636
         }
1643
         }
1637
 
1644
 
1638
         room.on(ConferenceEvents.CONNECTION_INTERRUPTED, () => {
1645
         room.on(ConferenceEvents.CONNECTION_INTERRUPTED, () => {
1646
+            APP.store.dispatch(localParticipantConnectionStatusChanged(
1647
+                participantConnectionStatus.INTERRUPTED));
1648
+
1639
             APP.UI.showLocalConnectionInterrupted(true);
1649
             APP.UI.showLocalConnectionInterrupted(true);
1640
         });
1650
         });
1641
 
1651
 
1642
         room.on(ConferenceEvents.CONNECTION_RESTORED, () => {
1652
         room.on(ConferenceEvents.CONNECTION_RESTORED, () => {
1653
+            APP.store.dispatch(localParticipantConnectionStatusChanged(
1654
+                participantConnectionStatus.ACTIVE));
1655
+
1643
             APP.UI.showLocalConnectionInterrupted(false);
1656
             APP.UI.showLocalConnectionInterrupted(false);
1644
         });
1657
         });
1645
 
1658
 

+ 20
- 0
react/features/base/participants/actions.js Ver fichero

30
     };
30
     };
31
 }
31
 }
32
 
32
 
33
+/**
34
+ * Creates an action to signal the connection status of the local participant
35
+ * has changed.
36
+ *
37
+ * @param {string} connectionStatus - The current connection status of the local
38
+ * participant, as enumerated by the library's participantConnectionStatus
39
+ * constants.
40
+ * @returns {Function}
41
+ */
42
+export function localParticipantConnectionStatusChanged(connectionStatus) {
43
+    return (dispatch, getState) => {
44
+        const participant = getLocalParticipant(getState);
45
+
46
+        if (participant) {
47
+            return dispatch(participantConnectionStatusChanged(
48
+                participant.id, connectionStatus));
49
+        }
50
+    };
51
+}
52
+
33
 /**
53
 /**
34
  * Action to signal that the ID of local participant has changed. It happens
54
  * Action to signal that the ID of local participant has changed. It happens
35
  * when the local participant joins a new conference or leaves an existing
55
  * when the local participant joins a new conference or leaves an existing

Loading…
Cancelar
Guardar