Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Change order of remote videos when clicking on shortcut

Ilya Daynatovichc6c701330a33
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index 021a41862a..3bccf41f2f 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -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();
}
};
diff --git a/modules/keyboardshortcut/keyboardshortcut.js b/modules/keyboardshortcut/keyboardshortcut.js
index 027378c8d6..53497347a2 100644
--- a/modules/keyboardshortcut/keyboardshortcut.js
+++ b/modules/keyboardshortcut/keyboardshortcut.js
@@ -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" &&