Переглянути джерело

Change order of remote videos when clicking on shortcut

master
Ilya Daynatovich 8 роки тому
джерело
коміт
c6c701330a
2 змінених файлів з 18 додано та 4 видалено
  1. 17
    3
      modules/UI/UI.js
  2. 1
    1
      modules/keyboardshortcut/keyboardshortcut.js

+ 17
- 3
modules/UI/UI.js Переглянути файл

@@ -819,9 +819,23 @@ UI.emitEvent = function (type, options) {
819 819
 };
820 820
 
821 821
 UI.clickOnVideo = function (videoNumber) {
822
-    var remoteVideos = $(".videocontainer:not(#mixedstream)");
823
-    if (remoteVideos.length > videoNumber) {
824
-        remoteVideos[videoNumber].click();
822
+    let videos = $(".videocontainer:not(#mixedstream)").toArray();
823
+
824
+    // Remove large video container if matched and reverse order of
825
+    // remote video containers
826
+    let videosMap = videos.filter(el => el.id !== 'largeVideoContainer')
827
+          .reduce((videoObj, video) => {
828
+              if(video.id === 'localVideoContainer') {
829
+                  videoObj.local = video;
830
+              } else {
831
+                  videoObj.remote.unshift(video);
832
+              }
833
+              return videoObj;
834
+          }, { local: null, remote: [] });
835
+
836
+    let sortedVideos = [videosMap.local, ...videosMap.remote];
837
+    if (sortedVideos.length > videoNumber) {
838
+        $(sortedVideos[videoNumber]).click();
825 839
     }
826 840
 };
827 841
 

+ 1
- 1
modules/keyboardshortcut/keyboardshortcut.js Переглянути файл

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

Завантаження…
Відмінити
Зберегти