Change order of remote videos when clicking on shortcut

This commit is contained in:
Ilya Daynatovich 2016-11-01 12:30:43 +02:00
parent f02f050e56
commit c6c701330a
2 changed files with 18 additions and 4 deletions

View File

@ -819,9 +819,23 @@ UI.emitEvent = function (type, options) {
};
UI.clickOnVideo = function (videoNumber) {
var remoteVideos = $(".videocontainer:not(#mixedstream)");
if (remoteVideos.length > videoNumber) {
remoteVideos[videoNumber].click();
let videos = $(".videocontainer:not(#mixedstream)").toArray();
// Remove large video container if matched and reverse order of
// remote video containers
let videosMap = videos.filter(el => el.id !== 'largeVideoContainer')
.reduce((videoObj, video) => {
if(video.id === 'localVideoContainer') {
videoObj.local = video;
} else {
videoObj.remote.unshift(video);
}
return videoObj;
}, { local: null, remote: [] });
let sortedVideos = [videosMap.local, ...videosMap.remote];
if (sortedVideos.length > videoNumber) {
$(sortedVideos[videoNumber]).click();
}
};

View File

@ -83,7 +83,7 @@ var KeyboardShortcut = {
_shortcuts[key].function(e);
}
else if (!isNaN(num) && num >= 0 && num <= 9) {
APP.UI.clickOnVideo(num + 1);
APP.UI.clickOnVideo(num);
}
//esc while the smileys are visible hides them
} else if (key === "ESCAPE" &&