Selaa lähdekoodia

Change order of remote videos when clicking on shortcut

master
Ilya Daynatovich 8 vuotta sitten
vanhempi
commit
c6c701330a
2 muutettua tiedostoa jossa 18 lisäystä ja 4 poistoa
  1. 17
    3
      modules/UI/UI.js
  2. 1
    1
      modules/keyboardshortcut/keyboardshortcut.js

+ 17
- 3
modules/UI/UI.js Näytä tiedosto

819
 };
819
 };
820
 
820
 
821
 UI.clickOnVideo = function (videoNumber) {
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 Näytä tiedosto

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

Loading…
Peruuta
Tallenna