|
@@ -214,7 +214,8 @@ var VideoLayout = {
|
214
|
214
|
|
215
|
215
|
// We'll show user's avatar if he is the dominant speaker or if
|
216
|
216
|
// his video thumbnail is pinned
|
217
|
|
- if (remoteVideos[id] && (id === focusedVideoResourceJid || id === currentDominantSpeaker)) {
|
|
217
|
+ if (remoteVideos[id] && (id === focusedVideoResourceJid
|
|
218
|
+ || id === currentDominantSpeaker)) {
|
218
|
219
|
newId = id;
|
219
|
220
|
} else {
|
220
|
221
|
// Otherwise select last visible video
|
|
@@ -357,7 +358,7 @@ var VideoLayout = {
|
357
|
358
|
BottomToolbar.getThumbs().length >= localLastNCount + 2) {
|
358
|
359
|
remoteVideo.showPeerContainer('hide');
|
359
|
360
|
} else {
|
360
|
|
- VideoLayout.resizeThumbnails();
|
|
361
|
+ VideoLayout.resizeThumbnails(false, true);
|
361
|
362
|
}
|
362
|
363
|
},
|
363
|
364
|
|
|
@@ -441,14 +442,15 @@ var VideoLayout = {
|
441
|
442
|
/**
|
442
|
443
|
* Resizes thumbnails.
|
443
|
444
|
*/
|
444
|
|
- resizeThumbnails (animate = false) {
|
|
445
|
+ resizeThumbnails (animate = false, show = false) {
|
445
|
446
|
let {thumbWidth, thumbHeight} = this.calculateThumbnailSize();
|
446
|
447
|
|
447
|
448
|
$('.userAvatar').css('left', (thumbWidth - thumbHeight) / 2);
|
448
|
449
|
|
449
|
|
- BottomToolbar.resizeThumbnails(thumbWidth, thumbHeight, animate).then(function () {
|
450
|
|
- BottomToolbar.resizeToolbar(thumbWidth, thumbHeight);
|
451
|
|
- AudioLevels.updateCanvasSize(thumbWidth, thumbHeight);
|
|
450
|
+ BottomToolbar.resizeThumbnails(thumbWidth, thumbHeight, animate, show)
|
|
451
|
+ .then(function () {
|
|
452
|
+ BottomToolbar.resizeToolbar(thumbWidth, thumbHeight);
|
|
453
|
+ AudioLevels.updateCanvasSize(thumbWidth, thumbHeight);
|
452
|
454
|
});
|
453
|
455
|
},
|
454
|
456
|
|
|
@@ -616,7 +618,6 @@ var VideoLayout = {
|
616
|
618
|
|
617
|
619
|
// Update the local LastN set preserving the order in which the
|
618
|
620
|
// endpoints appeared in the LastN/local LastN set.
|
619
|
|
-
|
620
|
621
|
var nextLocalLastNSet = lastNEndpoints.slice(0);
|
621
|
622
|
for (var i = 0; i < localLastNSet.length; i++) {
|
622
|
623
|
if (nextLocalLastNSet.length >= localLastNCount) {
|
|
@@ -635,6 +636,7 @@ var VideoLayout = {
|
635
|
636
|
// Handle LastN/local LastN changes.
|
636
|
637
|
BottomToolbar.getThumbs().each(( index, element ) => {
|
637
|
638
|
var resourceJid = getPeerContainerResourceId(element);
|
|
639
|
+ var smallVideo = remoteVideos[resourceJid];
|
638
|
640
|
|
639
|
641
|
// We do not want to process any logic for our own(local) video
|
640
|
642
|
// because the local participant is never in the lastN set.
|
|
@@ -651,17 +653,17 @@ var VideoLayout = {
|
651
|
653
|
lastNEndpoints.indexOf(resourceJid) < 0 &&
|
652
|
654
|
localLastNSet.indexOf(resourceJid) < 0) {
|
653
|
655
|
console.log("Remove from last N", resourceJid);
|
654
|
|
- if (remoteVideos[resourceJid])
|
655
|
|
- remoteVideos[resourceJid].showPeerContainer('hide');
|
|
656
|
+ if (smallVideo)
|
|
657
|
+ smallVideo.showPeerContainer('hide');
|
656
|
658
|
else if (!APP.conference.isLocalId(resourceJid))
|
657
|
659
|
console.error("No remote video for: " + resourceJid);
|
658
|
660
|
isReceived = false;
|
659
|
661
|
} else if (resourceJid &&
|
660
|
|
- $('#participant_' + resourceJid).is(':visible') &&
|
|
662
|
+ smallVideo.isVisible() &&
|
661
|
663
|
lastNEndpoints.indexOf(resourceJid) < 0 &&
|
662
|
664
|
localLastNSet.indexOf(resourceJid) >= 0) {
|
663
|
|
- if (remoteVideos[resourceJid])
|
664
|
|
- remoteVideos[resourceJid].showPeerContainer('avatar');
|
|
665
|
+ if (smallVideo)
|
|
666
|
+ smallVideo.showPeerContainer('avatar');
|
665
|
667
|
else if (!APP.conference.isLocalId(resourceJid))
|
666
|
668
|
console.error("No remote video for: " + resourceJid);
|
667
|
669
|
isReceived = false;
|
|
@@ -685,19 +687,15 @@ var VideoLayout = {
|
685
|
687
|
if (endpointsEnteringLastN && endpointsEnteringLastN.length > 0) {
|
686
|
688
|
endpointsEnteringLastN.forEach(function (resourceJid) {
|
687
|
689
|
|
688
|
|
- var isVisible = $('#participant_' + resourceJid).is(':visible');
|
689
|
690
|
var remoteVideo = remoteVideos[resourceJid];
|
690
|
691
|
remoteVideo.showPeerContainer('show');
|
691
|
|
- if (!isVisible) {
|
|
692
|
+
|
|
693
|
+ if (!remoteVideo.isVisible()) {
|
692
|
694
|
console.log("Add to last N", resourceJid);
|
693
|
695
|
|
694
|
|
- var jid = APP.xmpp.findJidFromResource(resourceJid);
|
695
|
|
- var mediaStream =
|
696
|
|
- APP.RTC.remoteStreams[jid]['video'];
|
697
|
|
- var sel = remoteVideo.selectVideoElement();
|
|
696
|
+ remoteVideo.addRemoteStreamElement(remoteVideo.stream);
|
698
|
697
|
|
699
|
|
- APP.RTC.attachMediaStream(sel, mediaStream.stream);
|
700
|
|
- if (lastNPickupId == mediaStream.peerjid) {
|
|
698
|
+ if (lastNPickupId == resourceJid) {
|
701
|
699
|
// Clean up the lastN pickup id.
|
702
|
700
|
lastNPickupId = null;
|
703
|
701
|
|
|
@@ -705,12 +703,12 @@ var VideoLayout = {
|
705
|
703
|
// been fired in the contact list click handler.
|
706
|
704
|
VideoLayout.handleVideoThumbClicked(
|
707
|
705
|
false,
|
708
|
|
- Strophe.getResourceFromJid(mediaStream.peerjid));
|
|
706
|
+ resourceJid);
|
709
|
707
|
|
710
|
708
|
updateLargeVideo = false;
|
711
|
709
|
}
|
712
|
|
- remoteVideos[resourceJid].
|
713
|
|
- waitForPlayback(sel, mediaStream);
|
|
710
|
+ remoteVideo.waitForPlayback(
|
|
711
|
+ remoteVideo.selectVideoElement(), remoteVideo.stream);
|
714
|
712
|
}
|
715
|
713
|
});
|
716
|
714
|
}
|