Browse Source

Rename classname; Refactor click on video method

j8
Ilya Daynatovich 8 years ago
parent
commit
30e717bd20
4 changed files with 10 additions and 19 deletions
  1. 1
    1
      css/_videolayout_default.scss
  2. 1
    1
      index.html
  3. 7
    16
      modules/UI/UI.js
  4. 1
    1
      modules/UI/videolayout/RemoteVideo.js

+ 1
- 1
css/_videolayout_default.scss View File

44
     position: relative;
44
     position: relative;
45
     text-align: center;
45
     text-align: center;
46
 
46
 
47
-    &__wrapper {
47
+    &__background {
48
         @include topLeft();
48
         @include topLeft();
49
         width: 100%;
49
         width: 100%;
50
         height: 100%;
50
         height: 100%;

+ 1
- 1
index.html View File

169
 
169
 
170
             <div id="remoteVideos">
170
             <div id="remoteVideos">
171
                 <span id="localVideoContainer" class="videocontainer videocontainer_small">
171
                 <span id="localVideoContainer" class="videocontainer videocontainer_small">
172
-                    <div class="videocontainer__wrapper"></div>
172
+                    <div class="videocontainer__background"></div>
173
                     <span id="localVideoWrapper">
173
                     <span id="localVideoWrapper">
174
                         <!--<video id="localVideo" autoplay muted></video> - is now per stream generated -->
174
                         <!--<video id="localVideo" autoplay muted></video> - is now per stream generated -->
175
                     </span>
175
                     </span>

+ 7
- 16
modules/UI/UI.js View File

819
 };
819
 };
820
 
820
 
821
 UI.clickOnVideo = function (videoNumber) {
821
 UI.clickOnVideo = function (videoNumber) {
822
-    let videos = $("#remoteVideos .videocontainer:not(#mixedstream)").toArray();
823
-
824
-    // Separate remotes from local videocontainer and reverse order of
825
-    // remote ones
826
-    let videosMap = videos.reduce((videoObj, video) => {
827
-              if(video.id === 'localVideoContainer') {
828
-                  videoObj.local = video;
829
-              } else {
830
-                  videoObj.remote.unshift(video);
831
-              }
832
-              return videoObj;
833
-          }, { local: null, remote: [] });
834
-
835
-    let sortedVideos = [videosMap.local, ...videosMap.remote];
836
-    if (sortedVideos.length > videoNumber) {
837
-        $(sortedVideos[videoNumber]).click();
822
+    let videos = $("#remoteVideos .videocontainer:not(#mixedstream)");
823
+    let videosLength = videos.length;
824
+
825
+    if(videosLength <= videoNumber) {
826
+        return;
838
     }
827
     }
828
+    let videoIndex = videoNumber === 0 ? 0 : videosLength - videoNumber;
829
+    videos[videoIndex].click();
839
 };
830
 };
840
 
831
 
841
 //Used by torture
832
 //Used by torture

+ 1
- 1
modules/UI/videolayout/RemoteVideo.js View File

632
     container.className = 'videocontainer';
632
     container.className = 'videocontainer';
633
 
633
 
634
     let wrapper = document.createElement('div');
634
     let wrapper = document.createElement('div');
635
-    wrapper.className = 'videocontainer__wrapper';
635
+    wrapper.className = 'videocontainer__background';
636
     container.appendChild(wrapper);
636
     container.appendChild(wrapper);
637
 
637
 
638
     let indicatorBar = document.createElement('div');
638
     let indicatorBar = document.createElement('div');

Loading…
Cancel
Save