Rename classname; Refactor click on video method

This commit is contained in:
Ilya Daynatovich 2016-11-03 12:13:03 +02:00
parent d703271c96
commit 30e717bd20
4 changed files with 9 additions and 18 deletions

View File

@ -44,7 +44,7 @@
position: relative; position: relative;
text-align: center; text-align: center;
&__wrapper { &__background {
@include topLeft(); @include topLeft();
width: 100%; width: 100%;
height: 100%; height: 100%;

View File

@ -169,7 +169,7 @@
<div id="remoteVideos"> <div id="remoteVideos">
<span id="localVideoContainer" class="videocontainer videocontainer_small"> <span id="localVideoContainer" class="videocontainer videocontainer_small">
<div class="videocontainer__wrapper"></div> <div class="videocontainer__background"></div>
<span id="localVideoWrapper"> <span id="localVideoWrapper">
<!--<video id="localVideo" autoplay muted></video> - is now per stream generated --> <!--<video id="localVideo" autoplay muted></video> - is now per stream generated -->
</span> </span>

View File

@ -819,23 +819,14 @@ UI.emitEvent = function (type, options) {
}; };
UI.clickOnVideo = function (videoNumber) { UI.clickOnVideo = function (videoNumber) {
let videos = $("#remoteVideos .videocontainer:not(#mixedstream)").toArray(); let videos = $("#remoteVideos .videocontainer:not(#mixedstream)");
let videosLength = videos.length;
// Separate remotes from local videocontainer and reverse order of if(videosLength <= videoNumber) {
// remote ones return;
let videosMap = videos.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();
} }
let videoIndex = videoNumber === 0 ? 0 : videosLength - videoNumber;
videos[videoIndex].click();
}; };
//Used by torture //Used by torture

View File

@ -632,7 +632,7 @@ RemoteVideo.createContainer = function (spanId) {
container.className = 'videocontainer'; container.className = 'videocontainer';
let wrapper = document.createElement('div'); let wrapper = document.createElement('div');
wrapper.className = 'videocontainer__wrapper'; wrapper.className = 'videocontainer__background';
container.appendChild(wrapper); container.appendChild(wrapper);
let indicatorBar = document.createElement('div'); let indicatorBar = document.createElement('div');