Lyubo Marinov 7 роки тому
джерело
коміт
2d73e9ace4

+ 1
- 1
react/features/base/conference/middleware.js Переглянути файл

185
         let videoType;
185
         let videoType;
186
 
186
 
187
         if ((participantById && participantById.local)
187
         if ((participantById && participantById.local)
188
-            || (!id && pinnedParticipant && pinnedParticipant.local)) {
188
+                || (!id && pinnedParticipant && pinnedParticipant.local)) {
189
             videoType = 'local';
189
             videoType = 'local';
190
         } else {
190
         } else {
191
             videoType = 'remote';
191
             videoType = 'remote';

+ 33
- 32
react/features/base/participants/actions.js Переглянути файл

32
     };
32
     };
33
 }
33
 }
34
 
34
 
35
+/**
36
+ * Create an action for removing a participant from the conference.
37
+ *
38
+ * @param {string} id - Participant's ID.
39
+ * @returns {{
40
+ *     type: KICK_PARTICIPANT,
41
+ *     id: string
42
+ * }}
43
+ */
44
+export function kickParticipant(id) {
45
+    return {
46
+        type: KICK_PARTICIPANT,
47
+        id
48
+    };
49
+}
50
+
35
 /**
51
 /**
36
  * Creates an action to signal the connection status of the local participant
52
  * Creates an action to signal the connection status of the local participant
37
  * has changed.
53
  * has changed.
47
 
63
 
48
         if (participant) {
64
         if (participant) {
49
             return dispatch(participantConnectionStatusChanged(
65
             return dispatch(participantConnectionStatusChanged(
50
-                participant.id, connectionStatus));
66
+                participant.id,
67
+                connectionStatus));
51
         }
68
         }
52
     };
69
     };
53
 }
70
 }
54
 
71
 
55
-/**
56
- * Create an action for removing a participant from the conference.
57
- *
58
- * @param {string} id - Participant's ID.
59
- * @returns {{
60
- *     type: KICK_PARTICIPANT,
61
- *     id: string
62
- * }}
63
- */
64
-export function kickParticipant(id) {
65
-    return {
66
-        type: KICK_PARTICIPANT,
67
-        id
68
-    };
69
-}
70
-
71
 /**
72
 /**
72
  * Action to signal that the ID of local participant has changed. It happens
73
  * Action to signal that the ID of local participant has changed. It happens
73
  * when the local participant joins a new conference or leaves an existing
74
  * when the local participant joins a new conference or leaves an existing
106
     });
107
     });
107
 }
108
 }
108
 
109
 
110
+/**
111
+ * Action to remove a local participant.
112
+ *
113
+ * @returns {Function}
114
+ */
115
+export function localParticipantLeft() {
116
+    return (dispatch, getState) => {
117
+        const participant = getLocalParticipant(getState);
118
+
119
+        if (participant) {
120
+            return dispatch(participantLeft(participant.id));
121
+        }
122
+    };
123
+}
124
+
109
 /**
125
 /**
110
  * Action to signal the role of the local participant has changed. It can happen
126
  * Action to signal the role of the local participant has changed. It can happen
111
  * when the participant has joined a conference, even before a non-default local
127
  * when the participant has joined a conference, even before a non-default local
164
     };
180
     };
165
 }
181
 }
166
 
182
 
167
-/**
168
- * Action to remove a local participant.
169
- *
170
- * @returns {Function}
171
- */
172
-export function localParticipantLeft() {
173
-    return (dispatch, getState) => {
174
-        const participant = getLocalParticipant(getState);
175
-
176
-        if (participant) {
177
-            return dispatch(participantLeft(participant.id));
178
-        }
179
-    };
180
-}
181
-
182
 /**
183
 /**
183
  * Action to signal that a participant's display name has changed.
184
  * Action to signal that a participant's display name has changed.
184
  *
185
  *

+ 14
- 12
react/features/large-video/actions.js Переглянути файл

110
  * @returns {(string|undefined)}
110
  * @returns {(string|undefined)}
111
  */
111
  */
112
 function _electParticipantInLargeVideo(state) {
112
 function _electParticipantInLargeVideo(state) {
113
-    // First get the pinned participant. If a participant is pinned, they will
114
-    // be shown in the LargeVideo.
113
+    // 1. If a participant is pinned, they will be shown in the LargeVideo (
114
+    //    regardless of whether they are local or remote).
115
     const participants = state['features/base/participants'];
115
     const participants = state['features/base/participants'];
116
     let participant = participants.find(p => p.pinned);
116
     let participant = participants.find(p => p.pinned);
117
     let id = participant && participant.id;
117
     let id = participant && participant.id;
118
 
118
 
119
     if (!id) {
119
     if (!id) {
120
-        // No participant is pinned so get the dominant speaker. But the local
121
-        // participant won't be displayed in LargeVideo even if he/she is the
122
-        // dominant speaker.
120
+        // 2. No participant is pinned so get the dominant speaker. But the
121
+        //    local participant won't be displayed in LargeVideo even if she is
122
+        //    the dominant speaker.
123
         participant = participants.find(p => p.dominantSpeaker && !p.local);
123
         participant = participants.find(p => p.dominantSpeaker && !p.local);
124
         id = participant && participant.id;
124
         id = participant && participant.id;
125
 
125
 
126
         if (!id) {
126
         if (!id) {
127
-            // There is no dominant speaker so select the participant which last
128
-            // had visible video (excluding ourselves).
127
+            // 3. There is no dominant speaker so select the remote participant
128
+            //    who last had visible video.
129
             const tracks = state['features/base/tracks'];
129
             const tracks = state['features/base/tracks'];
130
             const videoTrack = _electLastVisibleRemoteVideo(tracks);
130
             const videoTrack = _electLastVisibleRemoteVideo(tracks);
131
 
131
 
132
             id = videoTrack && videoTrack.participantId;
132
             id = videoTrack && videoTrack.participantId;
133
 
133
 
134
             if (!id) {
134
             if (!id) {
135
-                // It's possible there is no participant with visible video,
136
-                // this can happen for a number or reasons:
137
-                //  - there is only one participant (the local user)
138
-                //  - other participants joined with video muted
139
-                // As a last resort, pick the last participant.
135
+                // 4. It's possible there is no participant with visible video.
136
+                //    This can happen for a number of reasons:
137
+                //    - there is only one participant (i.e. the local user),
138
+                //    - other participants joined with video muted.
139
+                //    As a last resort, pick the last participant who joined the
140
+                //    conference (regardless of whether they are local or
141
+                //    remote).
140
                 participant = participants[participants.length - 1];
142
                 participant = participants[participants.length - 1];
141
                 id = participant && participant.id;
143
                 id = participant && participant.id;
142
             }
144
             }

+ 4
- 6
react/features/large-video/middleware.js Переглянути файл

1
+// @flow
2
+
1
 import {
3
 import {
2
     DOMINANT_SPEAKER_CHANGED,
4
     DOMINANT_SPEAKER_CHANGED,
3
     PARTICIPANT_JOINED,
5
     PARTICIPANT_JOINED,
12
     TRACK_UPDATED
14
     TRACK_UPDATED
13
 } from '../base/tracks';
15
 } from '../base/tracks';
14
 
16
 
15
-import {
16
-    selectParticipant,
17
-    selectParticipantInLargeVideo
18
-} from './actions';
17
+import { selectParticipant, selectParticipantInLargeVideo } from './actions';
19
 
18
 
20
 /**
19
 /**
21
  * Middleware that catches actions related to participants and tracks and
20
  * Middleware that catches actions related to participants and tracks and
37
         store.dispatch(selectParticipantInLargeVideo());
36
         store.dispatch(selectParticipantInLargeVideo());
38
         break;
37
         break;
39
 
38
 
40
-    case TRACK_UPDATED: {
39
+    case TRACK_UPDATED:
41
         // In order to minimize re-calculations, we need to select participant
40
         // In order to minimize re-calculations, we need to select participant
42
         // only if the videoType of the current participant rendered in
41
         // only if the videoType of the current participant rendered in
43
         // LargeVideo has changed.
42
         // LargeVideo has changed.
54
         }
53
         }
55
         break;
54
         break;
56
     }
55
     }
57
-    }
58
 
56
 
59
     return result;
57
     return result;
60
 });
58
 });

+ 2
- 0
react/features/large-video/reducer.js Переглянути файл

1
+// @flow
2
+
1
 import { PARTICIPANT_ID_CHANGED } from '../base/participants';
3
 import { PARTICIPANT_ID_CHANGED } from '../base/participants';
2
 import { ReducerRegistry } from '../base/redux';
4
 import { ReducerRegistry } from '../base/redux';
3
 
5
 

Завантаження…
Відмінити
Зберегти