Ver código fonte

Remove remote participants who are no longer of interest

The Jitsi Meet app always has at most 1 conference of primary interest.
It may have to juggle with 2 JitsiConference instances at the same time
if 1 is in the process of being left and one is joining/joined. But the
one which is joining or joined (which we call conference in the
features/base/conference redux state) is the one "of interest", the
other one is "clean up". Consequently, the remote participants of the
conference "of interest" are the remote participants "of interest" and
the others are "clean up". In order to reduce the time during which
there may be multiplying remote thumbnails, clean the remote
participants who are no longer "of interest" up.
master
Lyubo Marinov 7 anos atrás
pai
commit
ee9fcbb735
1 arquivos alterados com 22 adições e 1 exclusões
  1. 22
    1
      react/features/base/participants/middleware.js

+ 22
- 1
react/features/base/participants/middleware.js Ver arquivo

2
 
2
 
3
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../app';
3
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../app';
4
 import { CONFERENCE_LEFT, CONFERENCE_WILL_JOIN } from '../conference';
4
 import { CONFERENCE_LEFT, CONFERENCE_WILL_JOIN } from '../conference';
5
-import { MiddlewareRegistry } from '../redux';
5
+import { MiddlewareRegistry, StateListenerRegistry } from '../redux';
6
 import UIEvents from '../../../../service/UI/UIEvents';
6
 import UIEvents from '../../../../service/UI/UIEvents';
7
 import { playSound, registerSound, unregisterSound } from '../sounds';
7
 import { playSound, registerSound, unregisterSound } from '../sounds';
8
 
8
 
9
 import {
9
 import {
10
     localParticipantIdChanged,
10
     localParticipantIdChanged,
11
     localParticipantJoined,
11
     localParticipantJoined,
12
+    participantLeft,
12
     participantUpdated
13
     participantUpdated
13
 } from './actions';
14
 } from './actions';
14
 import {
15
 import {
124
     return next(action);
125
     return next(action);
125
 });
126
 });
126
 
127
 
128
+/**
129
+ * Syncs the redux state features/base/participants up with the redux state
130
+ * features/base/conference by ensuring that the former does not contain remote
131
+ * participants no longer relevant to the latter. Introduced to address an issue
132
+ * with multiplying thumbnails in the filmstrip.
133
+ */
134
+StateListenerRegistry.register(
135
+    /* selector */ state => {
136
+        const { conference, joining } = state['features/base/conference'];
137
+
138
+        return conference || joining;
139
+    },
140
+    /* listener */ (conference, { dispatch, getState }) => {
141
+        for (const p of getState()['features/base/participants']) {
142
+            !p.local
143
+                && (!conference || p.conference !== conference)
144
+                && dispatch(participantLeft(p.id, p.conference));
145
+        }
146
+    });
147
+
127
 /**
148
 /**
128
  * Initializes the local participant and signals that it joined.
149
  * Initializes the local participant and signals that it joined.
129
  *
150
  *

Carregando…
Cancelar
Salvar