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.
This commit is contained in:
parent
db21e97c19
commit
ee9fcbb735
|
@ -2,13 +2,14 @@
|
|||
|
||||
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../app';
|
||||
import { CONFERENCE_LEFT, CONFERENCE_WILL_JOIN } from '../conference';
|
||||
import { MiddlewareRegistry } from '../redux';
|
||||
import { MiddlewareRegistry, StateListenerRegistry } from '../redux';
|
||||
import UIEvents from '../../../../service/UI/UIEvents';
|
||||
import { playSound, registerSound, unregisterSound } from '../sounds';
|
||||
|
||||
import {
|
||||
localParticipantIdChanged,
|
||||
localParticipantJoined,
|
||||
participantLeft,
|
||||
participantUpdated
|
||||
} from './actions';
|
||||
import {
|
||||
|
@ -124,6 +125,26 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
return next(action);
|
||||
});
|
||||
|
||||
/**
|
||||
* Syncs the redux state features/base/participants up with the redux state
|
||||
* features/base/conference by ensuring that the former does not contain remote
|
||||
* participants no longer relevant to the latter. Introduced to address an issue
|
||||
* with multiplying thumbnails in the filmstrip.
|
||||
*/
|
||||
StateListenerRegistry.register(
|
||||
/* selector */ state => {
|
||||
const { conference, joining } = state['features/base/conference'];
|
||||
|
||||
return conference || joining;
|
||||
},
|
||||
/* listener */ (conference, { dispatch, getState }) => {
|
||||
for (const p of getState()['features/base/participants']) {
|
||||
!p.local
|
||||
&& (!conference || p.conference !== conference)
|
||||
&& dispatch(participantLeft(p.id, p.conference));
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Initializes the local participant and signals that it joined.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue