fix(breakout-rooms) cleanup local tracks when a conference is left.

This commit is contained in:
Дамян Минков 2021-12-09 11:46:27 -06:00
parent 700c7c523d
commit ae5c364333
1 changed files with 4 additions and 4 deletions

View File

@ -210,17 +210,17 @@ MiddlewareRegistry.register(store => next => action => {
/** /**
* Set up state change listener to perform maintenance tasks when the conference * Set up state change listener to perform maintenance tasks when the conference
* is left or failed, remove all remote tracks from the store. * is left or failed, remove all tracks from the store.
*/ */
StateListenerRegistry.register( StateListenerRegistry.register(
state => getCurrentConference(state), state => getCurrentConference(state),
(conference, { dispatch, getState }, prevConference) => { (conference, { dispatch, getState }, prevConference) => {
if (prevConference && !conference) { if (prevConference && !conference) {
// Clear all remote tracks. // Clear all tracks.
const remoteTracks = getState()['features/base/tracks'].filter(t => !t.local); const tracks = getState()['features/base/tracks'];
batch(() => { batch(() => {
for (const track of remoteTracks) { for (const track of tracks) {
dispatch(trackRemoved(track.jitsiTrack)); dispatch(trackRemoved(track.jitsiTrack));
} }
}); });