From 2bd0f7767145a3ed3c4f5d8562604d059366b954 Mon Sep 17 00:00:00 2001 From: virtuacoplenny Date: Thu, 21 Jun 2018 21:33:33 -0700 Subject: [PATCH] Move a couple calls to update VideoLayout into the redux update flow (#3173) * ref(video-layout): move middleware for TRACK_ADDED * ref(video-layout): call mucJoined when redux knowns of conference join --- conference.js | 2 +- modules/UI/UI.js | 17 ----------------- react/features/base/tracks/middleware.js | 9 --------- react/features/video-layout/middleware.web.js | 13 +++++++++++++ 4 files changed, 14 insertions(+), 27 deletions(-) diff --git a/conference.js b/conference.js index eadb0cbca..9a6afa8b9 100644 --- a/conference.js +++ b/conference.js @@ -2301,10 +2301,10 @@ export default { APP.store.dispatch(conferenceJoined(room)); - APP.UI.mucJoined(); const displayName = APP.store.getState()['features/base/settings'].displayName; + APP.UI.changeDisplayName('localVideoContainer', displayName); APP.API.notifyConferenceJoined( this.roomName, this._room.myUserId(), diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 140ff854a..c4351d6a4 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -267,16 +267,6 @@ UI.initConference = function() { followMeHandler = new FollowMe(APP.conference, UI); }; -UI.mucJoined = function() { - VideoLayout.mucJoined(); - - // Update local video now that a conference is joined a user ID should be - // set. - UI.changeDisplayName( - 'localVideoContainer', - APP.conference.getLocalDisplayName()); -}; - /** * * Handler for toggling filmstrip */ @@ -415,13 +405,6 @@ UI.addLocalStream = track => { } }; - -/** - * Show remote stream on UI. - * @param {JitsiTrack} track stream to show - */ -UI.addRemoteStream = track => VideoLayout.onRemoteStreamAdded(track); - /** * Removed remote stream from UI. * @param {JitsiTrack} track stream to remove diff --git a/react/features/base/tracks/middleware.js b/react/features/base/tracks/middleware.js index d5d503157..e88b48099 100644 --- a/react/features/base/tracks/middleware.js +++ b/react/features/base/tracks/middleware.js @@ -15,7 +15,6 @@ import UIEvents from '../../../../service/UI/UIEvents'; import { createLocalTracksA } from './actions'; import { TOGGLE_SCREENSHARING, - TRACK_ADDED, TRACK_REMOVED, TRACK_UPDATED } from './actionTypes'; @@ -93,14 +92,6 @@ MiddlewareRegistry.register(store => next => action => { } break; - case TRACK_ADDED: - // TODO Remove this middleware case once all UI interested in new tracks - // being added are converted to react and listening for store changes. - if (typeof APP !== 'undefined' && !action.track.local) { - APP.UI.addRemoteStream(action.track.jitsiTrack); - } - break; - case TRACK_REMOVED: // TODO Remove this middleware case once all UI interested in tracks // being removed are converted to react and listening for store changes. diff --git a/react/features/video-layout/middleware.web.js b/react/features/video-layout/middleware.web.js index 9fdbb9576..9ae4b453d 100644 --- a/react/features/video-layout/middleware.web.js +++ b/react/features/video-layout/middleware.web.js @@ -3,6 +3,7 @@ import VideoLayout from '../../../modules/UI/videolayout/VideoLayout.js'; import UIEvents from '../../../service/UI/UIEvents'; +import { CONFERENCE_JOINED } from '../base/conference'; import { DOMINANT_SPEAKER_CHANGED, PARTICIPANT_JOINED, @@ -12,6 +13,7 @@ import { getParticipantById } from '../base/participants'; import { MiddlewareRegistry } from '../base/redux'; +import { TRACK_ADDED } from '../base/tracks'; declare var APP: Object; @@ -30,6 +32,10 @@ MiddlewareRegistry.register(store => next => action => { const result = next(action); switch (action.type) { + case CONFERENCE_JOINED: + VideoLayout.mucJoined(); + break; + case PARTICIPANT_JOINED: if (!action.participant.local) { VideoLayout.addRemoteParticipantContainer( @@ -63,6 +69,13 @@ MiddlewareRegistry.register(store => next => action => { action.participant.id, Boolean(action.participant.id)); break; + + case TRACK_ADDED: + if (!action.track.local) { + VideoLayout.onRemoteStreamAdded(action.track.jitsiTrack); + } + + break; } return result;