Changes lastN event params to leaving and entering endpoint IDs.

Uses leavingIDs to more efficiently iterate over remote videos.
This commit is contained in:
damencho 2017-03-21 16:51:49 -05:00 committed by hristoterezov
parent d383230532
commit e29120a9c1
3 changed files with 28 additions and 20 deletions

View File

@ -1305,8 +1305,9 @@ export default {
});
room.on(
ConferenceEvents.LAST_N_ENDPOINTS_CHANGED, (ids, enteringIds) => {
APP.UI.handleLastNEndpoints(ids, enteringIds);
ConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
(leavingIds, enteringIds) => {
APP.UI.handleLastNEndpoints(leavingIds, enteringIds);
});
room.on(

View File

@ -837,8 +837,8 @@ UI.markDominantSpeaker = function (id) {
VideoLayout.onDominantSpeakerChanged(id);
};
UI.handleLastNEndpoints = function (ids, enteringIds) {
VideoLayout.onLastNEndpointsChanged(ids, enteringIds);
UI.handleLastNEndpoints = function (leavingIds, enteringIds) {
VideoLayout.onLastNEndpointsChanged(leavingIds, enteringIds);
};
/**

View File

@ -687,27 +687,34 @@ var VideoLayout = {
/**
* On last N change event.
*
* @param lastNEndpoints the list of last N endpoints
* @param endpointsLeavingLastN the list currently leaving last N
* endpoints
* @param endpointsEnteringLastN the list currently entering last N
* endpoints
*/
onLastNEndpointsChanged (lastNEndpoints, endpointsEnteringLastN) {
onLastNEndpointsChanged (endpointsLeavingLastN, endpointsEnteringLastN) {
if (endpointsLeavingLastN) {
endpointsLeavingLastN.forEach(this._updateRemoteVideo, this);
}
Object.keys(remoteVideos).forEach(
id => {
if (lastNEndpoints.length > 0
&& lastNEndpoints.indexOf(id) < 0
|| endpointsEnteringLastN.length > 0
&& endpointsEnteringLastN.indexOf(id) > 0) {
if (endpointsEnteringLastN) {
endpointsEnteringLastN.forEach(this._updateRemoteVideo, this);
}
},
let remoteVideo = (id) ? remoteVideos[id] : null;
/**
* Updates remote video by id if it exists.
* @param {string} id of the remote video
* @private
*/
_updateRemoteVideo(id) {
const remoteVideo = remoteVideos[id];
if (remoteVideo) {
remoteVideo.updateView();
if (remoteVideo.isCurrentlyOnLargeVideo())
if (remoteVideo.isCurrentlyOnLargeVideo()) {
this.updateLargeVideo(id);
}
}
});
},
/**