|
|
@@ -456,6 +456,11 @@ var VideoLayout = (function (my) {
|
|
456
|
456
|
return containerElement.id.substring(i + 12);
|
|
457
|
457
|
};
|
|
458
|
458
|
|
|
|
459
|
+ my.getPeerVideoSel = function (peerResourceJid) {
|
|
|
460
|
+ return $('#participant_' + peerResourceJid +
|
|
|
461
|
+ '>' + APP.RTC.getVideoElementName());
|
|
|
462
|
+ };
|
|
|
463
|
+
|
|
459
|
464
|
/**
|
|
460
|
465
|
* On contact list item clicked.
|
|
461
|
466
|
*/
|
|
|
@@ -464,40 +469,40 @@ var VideoLayout = (function (my) {
|
|
464
|
469
|
return;
|
|
465
|
470
|
}
|
|
466
|
471
|
|
|
|
472
|
+ if (jid == APP.xmpp.myJid()) {
|
|
|
473
|
+ $("#localVideoContainer").click();
|
|
|
474
|
+ return;
|
|
|
475
|
+ }
|
|
|
476
|
+
|
|
467
|
477
|
var resource = Strophe.getResourceFromJid(jid);
|
|
468
|
|
- var videoContainer = $("#participant_" + resource);
|
|
469
|
|
- if (videoContainer.length > 0) {
|
|
470
|
|
- var videoThumb
|
|
471
|
|
- = $(RTC.getVideoElementName(), videoContainer).get(0);
|
|
|
478
|
+ var videoSel = VideoLayout.getVideoSelector(resource);
|
|
|
479
|
+ if (videoSel.length > 0) {
|
|
|
480
|
+ var videoThumb = videoSel[0];
|
|
472
|
481
|
// It is not always the case that a videoThumb exists (if there is
|
|
473
|
482
|
// no actual video).
|
|
474
|
|
- if (videoThumb) {
|
|
475
|
|
- if (videoThumb.src && videoThumb.src != '') {
|
|
476
|
|
-
|
|
477
|
|
- // We have a video src, great! Let's update the large video
|
|
478
|
|
- // now.
|
|
479
|
|
-
|
|
480
|
|
- VideoLayout.handleVideoThumbClicked(
|
|
481
|
|
- false,
|
|
482
|
|
- Strophe.getResourceFromJid(jid));
|
|
483
|
|
- } else {
|
|
484
|
|
-
|
|
485
|
|
- // If we don't have a video src for jid, there's absolutely
|
|
486
|
|
- // no point in calling handleVideoThumbClicked; Quite
|
|
487
|
|
- // simply, it won't work because it needs an src to attach
|
|
488
|
|
- // to the large video.
|
|
489
|
|
- //
|
|
490
|
|
- // Instead, we trigger the pinned endpoint changed event to
|
|
491
|
|
- // let the bridge adjust its lastN set for myjid and store
|
|
492
|
|
- // the pinned user in the lastNPickupJid variable to be
|
|
493
|
|
- // picked up later by the lastN changed event handler.
|
|
494
|
|
-
|
|
495
|
|
- lastNPickupJid = jid;
|
|
496
|
|
- eventEmitter.emit(UIEvents.PINNED_ENDPOINT,
|
|
497
|
|
- Strophe.getResourceFromJid(jid));
|
|
498
|
|
- }
|
|
499
|
|
- } else if (jid == APP.xmpp.myJid()) {
|
|
500
|
|
- $("#localVideoContainer").click();
|
|
|
483
|
+ // FIXME: checking on .src will not work with Temasys plugin
|
|
|
484
|
+ if (videoThumb.src && videoThumb.src !== '') {
|
|
|
485
|
+
|
|
|
486
|
+ // We have a video src, great! Let's update the large video
|
|
|
487
|
+ // now.
|
|
|
488
|
+ VideoLayout.handleVideoThumbClicked(
|
|
|
489
|
+ false,
|
|
|
490
|
+ Strophe.getResourceFromJid(jid));
|
|
|
491
|
+ } else {
|
|
|
492
|
+
|
|
|
493
|
+ // If we don't have a video src for jid, there's absolutely
|
|
|
494
|
+ // no point in calling handleVideoThumbClicked; Quite
|
|
|
495
|
+ // simply, it won't work because it needs an src to attach
|
|
|
496
|
+ // to the large video.
|
|
|
497
|
+ //
|
|
|
498
|
+ // Instead, we trigger the pinned endpoint changed event to
|
|
|
499
|
+ // let the bridge adjust its lastN set for myjid and store
|
|
|
500
|
+ // the pinned user in the lastNPickupJid variable to be
|
|
|
501
|
+ // picked up later by the lastN changed event handler.
|
|
|
502
|
+
|
|
|
503
|
+ lastNPickupJid = jid;
|
|
|
504
|
+ eventEmitter.emit(UIEvents.PINNED_ENDPOINT,
|
|
|
505
|
+ Strophe.getResourceFromJid(jid));
|
|
501
|
506
|
}
|
|
502
|
507
|
}
|
|
503
|
508
|
});
|
|
|
@@ -530,11 +535,12 @@ var VideoLayout = (function (my) {
|
|
530
|
535
|
if (jid === APP.xmpp.myJid()) {
|
|
531
|
536
|
localVideoThumbnail.showVideoIndicator(value);
|
|
532
|
537
|
} else {
|
|
|
538
|
+ var resource = Strophe.getResourceFromJid(jid);
|
|
|
539
|
+
|
|
533
|
540
|
VideoLayout.ensurePeerContainerExists(jid);
|
|
534
|
|
- remoteVideos[Strophe.getResourceFromJid(jid)].showVideoIndicator(value);
|
|
|
541
|
+ remoteVideos[resource].showVideoIndicator(value);
|
|
535
|
542
|
|
|
536
|
|
- var el = $('#participant_' + Strophe.getResourceFromJid(jid)
|
|
537
|
|
- + '>' + APP.RTC.getVideoElementName());
|
|
|
543
|
+ var el = VideoLayout.getPeerVideoSel(resource);
|
|
538
|
544
|
if (!value)
|
|
539
|
545
|
el.show();
|
|
540
|
546
|
else
|
|
|
@@ -587,19 +593,15 @@ var VideoLayout = (function (my) {
|
|
587
|
593
|
}
|
|
588
|
594
|
|
|
589
|
595
|
// Obtain container for new dominant speaker.
|
|
590
|
|
- var container = document.getElementById(
|
|
591
|
|
- 'participant_' + resourceJid);
|
|
|
596
|
+ var videoSel = VideoLayout.getPeerVideoSel(resourceJid);
|
|
592
|
597
|
|
|
593
|
598
|
// Local video will not have container found, but that's ok
|
|
594
|
599
|
// since we don't want to switch to local video.
|
|
595
|
|
- if (container && !focusedVideoResourceJid)
|
|
|
600
|
+ if (!focusedVideoResourceJid && videoSel.length)
|
|
596
|
601
|
{
|
|
597
|
|
- var video
|
|
598
|
|
- = container.getElementsByTagName(RTC.getVideoElementName());
|
|
599
|
|
-
|
|
600
|
602
|
// Update the large video if the video source is already available,
|
|
601
|
603
|
// otherwise wait for the "videoactive.jingle" event.
|
|
602
|
|
- if (video.length && video[0].currentTime > 0) {
|
|
|
604
|
+ if (videoSel[0].currentTime > 0) {
|
|
603
|
605
|
LargeVideo.updateLargeVideo(resourceJid);
|
|
604
|
606
|
}
|
|
605
|
607
|
}
|
|
|
@@ -697,8 +699,7 @@ var VideoLayout = (function (my) {
|
|
697
|
699
|
|
|
698
|
700
|
var jid = APP.xmpp.findJidFromResource(resourceJid);
|
|
699
|
701
|
var mediaStream = APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE];
|
|
700
|
|
- var sel = $('#participant_' + resourceJid +
|
|
701
|
|
- '>' + RTC.getVideoElementName());
|
|
|
702
|
+ var sel = VideoLayout.getPeerVideoSel(resourceJid);
|
|
702
|
703
|
|
|
703
|
704
|
APP.RTC.attachMediaStream(sel, mediaStream.stream);
|
|
704
|
705
|
if (lastNPickupJid == mediaStream.peerjid) {
|