|
@@ -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
|
|