ref(video-layout): video layout controls own updating after user leave

This commit is contained in:
Leonard Kim 2018-05-21 14:22:41 -07:00 committed by virtuacoplenny
parent ec0439cbb1
commit 1e3dc20b44
7 changed files with 12 additions and 25 deletions

View File

@ -1713,7 +1713,11 @@ export default {
APP.store.dispatch(participantLeft(id, room));
logger.log('USER %s LEFT', id, user);
APP.API.notifyUserLeft(id);
APP.UI.removeUser(id, user.getDisplayName());
APP.UI.messageHandler.participantNotification(
user.getDisplayName(),
'notify.somebody',
'disconnected',
'notify.disconnected');
APP.UI.onSharedVideoStop(id);
});

View File

@ -504,18 +504,6 @@ UI.addUser = function(user) {
}
};
/**
* Remove user from UI.
* @param {string} id user id
* @param {string} displayName user nickname
*/
UI.removeUser = function(id, displayName) {
messageHandler.participantNotification(
displayName, 'notify.somebody', 'disconnected', 'notify.disconnected');
VideoLayout.removeParticipantContainer(id);
};
/**
* Update videotype for specified user.
* @param {string} id user id

View File

@ -497,7 +497,7 @@ export default class SharedVideoManager {
this.localAudioMutedListener);
this.localAudioMutedListener = null;
VideoLayout.removeParticipantContainer(this.url);
APP.store.dispatch(participantLeft(this.url, APP.conference._room));
VideoLayout.showLargeVideoContainer(SHARED_VIDEO_CONTAINER_TYPE, false)
.then(() => {
@ -522,8 +522,6 @@ export default class SharedVideoManager {
UIEvents.UPDATE_SHARED_VIDEO, null, 'removed');
});
APP.store.dispatch(participantLeft(this.url, APP.conference._room));
this.url = null;
this.isSharedVideoShown = false;
this.initialAttributes = null;

View File

@ -68,10 +68,6 @@ SharedVideoThumb.prototype.videoClick = function() {
SharedVideoThumb.prototype.remove = function() {
logger.log('Remove shared video thumb', this.id);
// Make sure that the large video is updated if are removing its
// corresponding small video.
this.VideoLayout.updateAfterThumbRemoved(this.id);
// Remove whole container
if (this.container.parentNode) {
this.container.parentNode.removeChild(this.container);

View File

@ -476,10 +476,6 @@ RemoteVideo.prototype.remove = function() {
this.removeRemoteVideoMenu();
// Make sure that the large video is updated if are removing its
// corresponding small video.
this.VideoLayout.updateAfterThumbRemoved(this.id);
// Remove whole container
if (this.container.parentNode) {
this.container.parentNode.removeChild(this.container);

View File

@ -253,7 +253,7 @@ const VideoLayout = {
* Uses focusedID if any or dominantSpeakerID if any,
* otherwise elects new video, in this order.
*/
updateAfterThumbRemoved(id) {
_updateAfterThumbRemoved(id) {
// Always trigger an update if large video is empty.
if (!largeVideo
|| (this.getLargeVideoID() && !this.isCurrentlyOnLarge(id))) {
@ -804,6 +804,7 @@ const VideoLayout = {
}
VideoLayout.resizeThumbnails();
VideoLayout._updateAfterThumbRemoved(id);
},
onVideoTypeChanged(id, newVideoType) {

View File

@ -5,6 +5,7 @@ import UIEvents from '../../../service/UI/UIEvents';
import {
DOMINANT_SPEAKER_CHANGED,
PARTICIPANT_LEFT,
PARTICIPANT_UPDATED,
PIN_PARTICIPANT
} from '../base/participants';
@ -27,6 +28,9 @@ MiddlewareRegistry.register(store => next => action => {
const result = next(action);
switch (action.type) {
case PARTICIPANT_LEFT:
VideoLayout.removeParticipantContainer(action.participant.id);
break;
case PARTICIPANT_UPDATED: {
// Look for actions that triggered a change to connectionStatus. This is