|
@@ -15,6 +15,11 @@ var ssrc2jid = {};
|
15
|
15
|
*/
|
16
|
16
|
var ssrc2videoType = {};
|
17
|
17
|
var videoSrcToSsrc = {};
|
|
18
|
+/**
|
|
19
|
+ * Currently focused video "src"(displayed in large video).
|
|
20
|
+ * @type {String}
|
|
21
|
+ */
|
|
22
|
+var focusedVideoSrc = null;
|
18
|
23
|
var mutedAudios = {};
|
19
|
24
|
|
20
|
25
|
var localVideoSrc = null;
|
|
@@ -353,7 +358,65 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
|
353
|
358
|
}
|
354
|
359
|
});
|
355
|
360
|
|
|
361
|
+/**
|
|
362
|
+ * Returns the JID of the user to whom given <tt>videoSrc</tt> belongs.
|
|
363
|
+ * @param videoSrc the video "src" identifier.
|
|
364
|
+ * @returns {null | String} the JID of the user to whom given <tt>videoSrc</tt>
|
|
365
|
+ * belongs.
|
|
366
|
+ */
|
|
367
|
+function getJidFromVideoSrc(videoSrc)
|
|
368
|
+{
|
|
369
|
+ if (videoSrc === localVideoSrc)
|
|
370
|
+ return connection.emuc.myroomjid;
|
|
371
|
+
|
|
372
|
+ var ssrc = videoSrcToSsrc[videoSrc];
|
|
373
|
+ if (!ssrc)
|
|
374
|
+ {
|
|
375
|
+ return null;
|
|
376
|
+ }
|
|
377
|
+ return ssrc2jid[ssrc];
|
|
378
|
+}
|
|
379
|
+
|
|
380
|
+/**
|
|
381
|
+ * Gets the selector of video thumbnail container for the user identified by
|
|
382
|
+ * given <tt>userJid</tt>
|
|
383
|
+ * @param userJid user's Jid for whom we want to get the video container.
|
|
384
|
+ */
|
|
385
|
+function getParticipantContainer(userJid)
|
|
386
|
+{
|
|
387
|
+ if (!userJid)
|
|
388
|
+ return null;
|
|
389
|
+
|
|
390
|
+ if (userJid === connection.emuc.myroomjid)
|
|
391
|
+ return $("#localVideoContainer");
|
|
392
|
+ else
|
|
393
|
+ return $("#participant_" + Strophe.getResourceFromJid(userJid));
|
|
394
|
+}
|
|
395
|
+
|
356
|
396
|
function handleVideoThumbClicked(videoSrc) {
|
|
397
|
+ // Restore style for previously focused video
|
|
398
|
+ var oldContainer =
|
|
399
|
+ getParticipantContainer(
|
|
400
|
+ getJidFromVideoSrc(focusedVideoSrc));
|
|
401
|
+ if (oldContainer)
|
|
402
|
+ oldContainer.removeClass("videoContainerFocused");
|
|
403
|
+
|
|
404
|
+ // Unlock
|
|
405
|
+ if (focusedVideoSrc === videoSrc)
|
|
406
|
+ {
|
|
407
|
+ focusedVideoSrc = null;
|
|
408
|
+ return;
|
|
409
|
+ }
|
|
410
|
+
|
|
411
|
+ // Lock new video
|
|
412
|
+ focusedVideoSrc = videoSrc;
|
|
413
|
+
|
|
414
|
+ var userJid = getJidFromVideoSrc(videoSrc);
|
|
415
|
+ if (userJid)
|
|
416
|
+ {
|
|
417
|
+ var container = getParticipantContainer(userJid);
|
|
418
|
+ container.addClass("videoContainerFocused");
|
|
419
|
+ }
|
357
|
420
|
|
358
|
421
|
$(document).trigger("video.selected", [false]);
|
359
|
422
|
|
|
@@ -499,7 +562,8 @@ $(document).bind('callactive.jingle', function (event, videoelem, sid) {
|
499
|
562
|
videoelem.show();
|
500
|
563
|
resizeThumbnails();
|
501
|
564
|
|
502
|
|
- updateLargeVideo(videoelem.attr('src'), 1);
|
|
565
|
+ if (!focusedVideoSrc)
|
|
566
|
+ updateLargeVideo(videoelem.attr('src'), 1);
|
503
|
567
|
|
504
|
568
|
showFocusIndicator();
|
505
|
569
|
}
|
|
@@ -618,6 +682,16 @@ $(document).bind('left.muc', function (event, jid) {
|
618
|
682
|
}
|
619
|
683
|
}, 10);
|
620
|
684
|
|
|
685
|
+ // Unlock large video
|
|
686
|
+ if (focusedVideoSrc)
|
|
687
|
+ {
|
|
688
|
+ if (getJidFromVideoSrc(focusedVideoSrc) === jid)
|
|
689
|
+ {
|
|
690
|
+ console.info("Focused video owner has left the conference");
|
|
691
|
+ focusedVideoSrc = null;
|
|
692
|
+ }
|
|
693
|
+ }
|
|
694
|
+
|
621
|
695
|
connection.jingle.terminateByJid(jid);
|
622
|
696
|
|
623
|
697
|
if (focus == null
|