|
@@ -61,11 +61,19 @@ var VideoLayout = (function (my) {
|
61
|
61
|
var localVideoSelector = $('#' + localVideo.id);
|
62
|
62
|
// Add click handler to both video and video wrapper elements in case
|
63
|
63
|
// there's no video.
|
64
|
|
- localVideoSelector.click(function () {
|
65
|
|
- VideoLayout.handleVideoThumbClicked(RTC.getVideoSrc(localVideo), false, connection.emuc.myroomjid);
|
|
64
|
+ localVideoSelector.click(function (event) {
|
|
65
|
+ event.stopPropagation();
|
|
66
|
+ VideoLayout.handleVideoThumbClicked(
|
|
67
|
+ RTC.getVideoSrc(localVideo),
|
|
68
|
+ false,
|
|
69
|
+ Strophe.getResourceFromJid(connection.emuc.myroomjid));
|
66
|
70
|
});
|
67
|
|
- $('#localVideoContainer').click(function () {
|
68
|
|
- VideoLayout.handleVideoThumbClicked(RTC.getVideoSrc(localVideo), false, connection.emuc.myroomjid);
|
|
71
|
+ $('#localVideoContainer').click(function (event) {
|
|
72
|
+ event.stopPropagation();
|
|
73
|
+ VideoLayout.handleVideoThumbClicked(
|
|
74
|
+ RTC.getVideoSrc(localVideo),
|
|
75
|
+ false,
|
|
76
|
+ Strophe.getResourceFromJid(connection.emuc.myroomjid));
|
69
|
77
|
});
|
70
|
78
|
|
71
|
79
|
// Add hover handler
|
|
@@ -155,15 +163,15 @@ var VideoLayout = (function (my) {
|
155
|
163
|
|
156
|
164
|
my.getLargeVideoState = function () {
|
157
|
165
|
return largeVideoState;
|
158
|
|
- }
|
|
166
|
+ };
|
159
|
167
|
|
160
|
168
|
/**
|
161
|
169
|
* Updates the large video with the given new video source.
|
162
|
170
|
*/
|
163
|
|
- my.updateLargeVideo = function(newSrc, vol, jid) {
|
|
171
|
+ my.updateLargeVideo = function(newSrc, vol, resourceJid) {
|
164
|
172
|
console.log('hover in', newSrc);
|
165
|
173
|
|
166
|
|
- if (RTC.getVideoSrc($('#largeVideo')[0]) != newSrc) {
|
|
174
|
+ if (RTC.getVideoSrc($('#largeVideo')[0]) !== newSrc) {
|
167
|
175
|
|
168
|
176
|
$('#activeSpeakerAvatar').css('visibility', 'hidden');
|
169
|
177
|
// Due to the simulcast the localVideoSrc may have changed when the
|
|
@@ -176,28 +184,26 @@ var VideoLayout = (function (my) {
|
176
|
184
|
|
177
|
185
|
largeVideoState.newSrc = newSrc;
|
178
|
186
|
largeVideoState.isVisible = $('#largeVideo').is(':visible');
|
179
|
|
- largeVideoState.isDesktop = isVideoSrcDesktop(jid);
|
180
|
|
- if(jid2Ssrc[largeVideoState.userJid] ||
|
|
187
|
+ largeVideoState.isDesktop = isVideoSrcDesktop(resourceJid);
|
|
188
|
+ if(jid2Ssrc[largeVideoState.userResourceJid] ||
|
181
|
189
|
(connection && connection.emuc.myroomjid &&
|
182
|
|
- largeVideoState.userJid == Strophe.getResourceFromJid(connection.emuc.myroomjid)))
|
183
|
|
- {
|
184
|
|
- largeVideoState.oldJid = largeVideoState.userJid;
|
185
|
|
- }
|
186
|
|
- else
|
187
|
|
- {
|
188
|
|
- largeVideoState.oldJid = null;
|
|
190
|
+ largeVideoState.userResourceJid ===
|
|
191
|
+ Strophe.getResourceFromJid(connection.emuc.myroomjid))) {
|
|
192
|
+ largeVideoState.oldResourceJid = largeVideoState.userResourceJid;
|
|
193
|
+ } else {
|
|
194
|
+ largeVideoState.oldResourceJid = null;
|
189
|
195
|
}
|
190
|
|
- largeVideoState.userJid = jid;
|
|
196
|
+ largeVideoState.userResourceJid = resourceJid;
|
191
|
197
|
|
192
|
198
|
// Screen stream is already rotated
|
193
|
199
|
largeVideoState.flipX = (newSrc === localVideoSrc) && flipXLocalVideo;
|
194
|
200
|
|
195
|
201
|
var userChanged = false;
|
196
|
|
- if (largeVideoState.oldJid != largeVideoState.userJid) {
|
|
202
|
+ if (largeVideoState.oldResourceJid !== largeVideoState.userResourceJid) {
|
197
|
203
|
userChanged = true;
|
198
|
204
|
// we want the notification to trigger even if userJid is undefined,
|
199
|
205
|
// or null.
|
200
|
|
- $(document).trigger("selectedendpointchanged", [largeVideoState.userJid]);
|
|
206
|
+ $(document).trigger("selectedendpointchanged", [largeVideoState.userResourceJid]);
|
201
|
207
|
}
|
202
|
208
|
|
203
|
209
|
if (!largeVideoState.updateInProgress) {
|
|
@@ -205,11 +211,13 @@ var VideoLayout = (function (my) {
|
205
|
211
|
|
206
|
212
|
var doUpdate = function () {
|
207
|
213
|
|
208
|
|
- Avatar.updateActiveSpeakerAvatarSrc(largeVideoState.userJid);
|
|
214
|
+ Avatar.updateActiveSpeakerAvatarSrc(
|
|
215
|
+ connection.emuc.findJidFromResource(
|
|
216
|
+ largeVideoState.userResourceJid));
|
209
|
217
|
|
210
|
|
- if (!userChanged && largeVideoState.preload
|
211
|
|
- && largeVideoState.preload != null
|
212
|
|
- && RTC.getVideoSrc($(largeVideoState.preload)[0]) == newSrc)
|
|
218
|
+ if (!userChanged && largeVideoState.preload &&
|
|
219
|
+ largeVideoState.preload !== null &&
|
|
220
|
+ RTC.getVideoSrc($(largeVideoState.preload)[0]) === newSrc)
|
213
|
221
|
{
|
214
|
222
|
|
215
|
223
|
console.info('Switching to preloaded video');
|
|
@@ -218,7 +226,7 @@ var VideoLayout = (function (my) {
|
218
|
226
|
// loop through largeVideo attributes and apply them on
|
219
|
227
|
// preload.
|
220
|
228
|
$.each(attributes, function () {
|
221
|
|
- if (this.name != 'id' && this.name != 'src') {
|
|
229
|
+ if (this.name !== 'id' && this.name !== 'src') {
|
222
|
230
|
largeVideoState.preload.attr(this.name, this.value);
|
223
|
231
|
}
|
224
|
232
|
});
|
|
@@ -263,13 +271,17 @@ var VideoLayout = (function (my) {
|
263
|
271
|
|
264
|
272
|
// Only if the large video is currently visible.
|
265
|
273
|
// Disable previous dominant speaker video.
|
266
|
|
- if (largeVideoState.oldJid) {
|
267
|
|
- VideoLayout.enableDominantSpeaker(largeVideoState.oldJid, false);
|
|
274
|
+ if (largeVideoState.oldResourceJid) {
|
|
275
|
+ VideoLayout.enableDominantSpeaker(
|
|
276
|
+ largeVideoState.oldResourceJid,
|
|
277
|
+ false);
|
268
|
278
|
}
|
269
|
279
|
|
270
|
280
|
// Enable new dominant speaker in the remote videos section.
|
271
|
|
- if (largeVideoState.userJid) {
|
272
|
|
- VideoLayout.enableDominantSpeaker(largeVideoState.userJid, true);
|
|
281
|
+ if (largeVideoState.userResourceJid) {
|
|
282
|
+ VideoLayout.enableDominantSpeaker(
|
|
283
|
+ largeVideoState.userResourceJid,
|
|
284
|
+ true);
|
273
|
285
|
}
|
274
|
286
|
|
275
|
287
|
if (userChanged && largeVideoState.isVisible) {
|
|
@@ -279,7 +291,9 @@ var VideoLayout = (function (my) {
|
279
|
291
|
}
|
280
|
292
|
|
281
|
293
|
if(userChanged) {
|
282
|
|
- Avatar.showUserAvatar(largeVideoState.oldJid);
|
|
294
|
+ Avatar.showUserAvatar(
|
|
295
|
+ connection.emuc.findJidFromResource(
|
|
296
|
+ largeVideoState.oldResourceJid));
|
283
|
297
|
}
|
284
|
298
|
|
285
|
299
|
largeVideoState.updateInProgress = false;
|
|
@@ -291,15 +305,21 @@ var VideoLayout = (function (my) {
|
291
|
305
|
doUpdate();
|
292
|
306
|
}
|
293
|
307
|
}
|
|
308
|
+ } else {
|
|
309
|
+ Avatar.showUserAvatar(
|
|
310
|
+ connection.emuc.findJidFromResource(
|
|
311
|
+ largeVideoState.userResourceJid));
|
294
|
312
|
}
|
295
|
313
|
};
|
296
|
314
|
|
297
|
|
- my.handleVideoThumbClicked = function(videoSrc, noPinnedEndpointChangedEvent, jid) {
|
|
315
|
+ my.handleVideoThumbClicked = function(videoSrc,
|
|
316
|
+ noPinnedEndpointChangedEvent,
|
|
317
|
+ resourceJid) {
|
298
|
318
|
// Restore style for previously focused video
|
299
|
319
|
var oldContainer = null;
|
300
|
|
- if(focusedVideoSrc) {
|
301
|
|
- var focusJid = focusedVideoSrc.jid;
|
302
|
|
- oldContainer = getParticipantContainer(focusJid);
|
|
320
|
+ if(focusedVideoInfo) {
|
|
321
|
+ var focusResourceJid = focusedVideoInfo.resouceJid;
|
|
322
|
+ oldContainer = getParticipantContainer(focusResourceJid);
|
303
|
323
|
}
|
304
|
324
|
|
305
|
325
|
if (oldContainer) {
|
|
@@ -307,9 +327,9 @@ var VideoLayout = (function (my) {
|
307
|
327
|
}
|
308
|
328
|
|
309
|
329
|
// Unlock current focused.
|
310
|
|
- if (focusedVideoSrc && focusedVideoSrc.src === videoSrc)
|
|
330
|
+ if (focusedVideoInfo && focusedVideoInfo.src === videoSrc)
|
311
|
331
|
{
|
312
|
|
- focusedVideoSrc = null;
|
|
332
|
+ focusedVideoInfo = null;
|
313
|
333
|
var dominantSpeakerVideo = null;
|
314
|
334
|
// Enable the currently set dominant speaker.
|
315
|
335
|
if (currentDominantSpeaker) {
|
|
@@ -318,7 +338,10 @@ var VideoLayout = (function (my) {
|
318
|
338
|
.get(0);
|
319
|
339
|
|
320
|
340
|
if (dominantSpeakerVideo) {
|
321
|
|
- VideoLayout.updateLargeVideo(RTC.getVideoSrc(dominantSpeakerVideo), 1, currentDominantSpeaker);
|
|
341
|
+ VideoLayout.updateLargeVideo(
|
|
342
|
+ RTC.getVideoSrc(dominantSpeakerVideo),
|
|
343
|
+ 1,
|
|
344
|
+ currentDominantSpeaker);
|
322
|
345
|
}
|
323
|
346
|
}
|
324
|
347
|
|
|
@@ -329,23 +352,23 @@ var VideoLayout = (function (my) {
|
329
|
352
|
}
|
330
|
353
|
|
331
|
354
|
// Lock new video
|
332
|
|
- focusedVideoSrc = {
|
|
355
|
+ focusedVideoInfo = {
|
333
|
356
|
src: videoSrc,
|
334
|
|
- jid: jid
|
|
357
|
+ resouceJid: resourceJid
|
335
|
358
|
};
|
336
|
359
|
|
337
|
360
|
// Update focused/pinned interface.
|
338
|
|
- if (jid)
|
|
361
|
+ if (resourceJid)
|
339
|
362
|
{
|
340
|
|
- var container = getParticipantContainer(jid);
|
|
363
|
+ var container = getParticipantContainer(resourceJid);
|
341
|
364
|
container.addClass("videoContainerFocused");
|
342
|
365
|
|
343
|
366
|
if (!noPinnedEndpointChangedEvent) {
|
344
|
|
- $(document).trigger("pinnedendpointchanged", [jid]);
|
|
367
|
+ $(document).trigger("pinnedendpointchanged", [resourceJid]);
|
345
|
368
|
}
|
346
|
369
|
}
|
347
|
370
|
|
348
|
|
- if ($('#largeVideo').attr('src') == videoSrc) {
|
|
371
|
+ if ($('#largeVideo').attr('src') === videoSrc) {
|
349
|
372
|
return;
|
350
|
373
|
}
|
351
|
374
|
|
|
@@ -353,7 +376,7 @@ var VideoLayout = (function (my) {
|
353
|
376
|
// this isn't a prezi.
|
354
|
377
|
$(document).trigger("video.selected", [false]);
|
355
|
378
|
|
356
|
|
- VideoLayout.updateLargeVideo(videoSrc, 1, Strophe.getResourceFromJid(jid));
|
|
379
|
+ VideoLayout.updateLargeVideo(videoSrc, 1, resourceJid);
|
357
|
380
|
|
358
|
381
|
$('audio').each(function (idx, el) {
|
359
|
382
|
if (el.id.indexOf('mixedmslabel') !== -1) {
|
|
@@ -399,7 +422,7 @@ var VideoLayout = (function (my) {
|
399
|
422
|
* Shows/hides the large video.
|
400
|
423
|
*/
|
401
|
424
|
my.setLargeVideoVisible = function(isVisible) {
|
402
|
|
- var resourceJid = largeVideoState.userJid;
|
|
425
|
+ var resourceJid = largeVideoState.userResourceJid;
|
403
|
426
|
|
404
|
427
|
if (isVisible) {
|
405
|
428
|
$('#largeVideo').css({visibility: 'visible'});
|
|
@@ -410,6 +433,16 @@ var VideoLayout = (function (my) {
|
410
|
433
|
$('#largeVideo').css({visibility: 'hidden'});
|
411
|
434
|
$('.watermark').css({visibility: 'hidden'});
|
412
|
435
|
VideoLayout.enableDominantSpeaker(resourceJid, false);
|
|
436
|
+ var focusJid = VideoLayout.getLargeVideoState().userJid;
|
|
437
|
+ var oldContainer = getParticipantContainer(focusJid);
|
|
438
|
+
|
|
439
|
+ if (oldContainer) {
|
|
440
|
+ oldContainer.removeClass("videoContainerFocused");
|
|
441
|
+ }
|
|
442
|
+ focusedVideoInfo = null;
|
|
443
|
+ if(focusJid) {
|
|
444
|
+ Avatar.showUserAvatar(focusJid);
|
|
445
|
+ }
|
413
|
446
|
}
|
414
|
447
|
};
|
415
|
448
|
|
|
@@ -565,7 +598,10 @@ var VideoLayout = (function (my) {
|
565
|
598
|
var videoThumb = $('#' + container.id + '>video').get(0);
|
566
|
599
|
|
567
|
600
|
if (videoThumb)
|
568
|
|
- VideoLayout.handleVideoThumbClicked(RTC.getVideoSrc(videoThumb), false, peerJid);
|
|
601
|
+ VideoLayout.handleVideoThumbClicked(
|
|
602
|
+ RTC.getVideoSrc(videoThumb),
|
|
603
|
+ false,
|
|
604
|
+ Strophe.getResourceFromJid(peerJid));
|
569
|
605
|
|
570
|
606
|
event.preventDefault();
|
571
|
607
|
return false;
|
|
@@ -1083,17 +1119,17 @@ var VideoLayout = (function (my) {
|
1083
|
1119
|
/**
|
1084
|
1120
|
* Gets the selector of video thumbnail container for the user identified by
|
1085
|
1121
|
* given <tt>userJid</tt>
|
1086
|
|
- * @param userJid user's Jid for whom we want to get the video container.
|
|
1122
|
+ * @param resourceJid user's Jid for whom we want to get the video container.
|
1087
|
1123
|
*/
|
1088
|
|
- function getParticipantContainer(userJid)
|
|
1124
|
+ function getParticipantContainer(resourceJid)
|
1089
|
1125
|
{
|
1090
|
|
- if (!userJid)
|
|
1126
|
+ if (!resourceJid)
|
1091
|
1127
|
return null;
|
1092
|
1128
|
|
1093
|
|
- if (userJid === connection.emuc.myroomjid)
|
|
1129
|
+ if (resourceJid === Strophe.getResourceFromJid(connection.emuc.myroomjid))
|
1094
|
1130
|
return $("#localVideoContainer");
|
1095
|
1131
|
else
|
1096
|
|
- return $("#participant_" + Strophe.getResourceFromJid(userJid));
|
|
1132
|
+ return $("#participant_" + resourceJid);
|
1097
|
1133
|
}
|
1098
|
1134
|
|
1099
|
1135
|
/**
|
|
@@ -1372,7 +1408,10 @@ var VideoLayout = (function (my) {
|
1372
|
1408
|
// We have a video src, great! Let's update the large video
|
1373
|
1409
|
// now.
|
1374
|
1410
|
|
1375
|
|
- VideoLayout.handleVideoThumbClicked(videoThumb.src, false, jid);
|
|
1411
|
+ VideoLayout.handleVideoThumbClicked(
|
|
1412
|
+ videoThumb.src,
|
|
1413
|
+ false,
|
|
1414
|
+ Strophe.getResourceFromJid(jid));
|
1376
|
1415
|
} else {
|
1377
|
1416
|
|
1378
|
1417
|
// If we don't have a video src for jid, there's absolutely
|
|
@@ -1501,7 +1540,7 @@ var VideoLayout = (function (my) {
|
1501
|
1540
|
|
1502
|
1541
|
// Local video will not have container found, but that's ok
|
1503
|
1542
|
// since we don't want to switch to local video.
|
1504
|
|
- if (container && !focusedVideoSrc)
|
|
1543
|
+ if (container && !focusedVideoInfo)
|
1505
|
1544
|
{
|
1506
|
1545
|
var video = container.getElementsByTagName("video");
|
1507
|
1546
|
|
|
@@ -1587,7 +1626,7 @@ var VideoLayout = (function (my) {
|
1587
|
1626
|
// it is no longer being received. If resourceJid was being
|
1588
|
1627
|
// displayed in the large video we have to switch to another
|
1589
|
1628
|
// user.
|
1590
|
|
- var largeVideoResource = largeVideoState.userJid;
|
|
1629
|
+ var largeVideoResource = largeVideoState.userResourceJid;
|
1591
|
1630
|
if (!updateLargeVideo && resourceJid === largeVideoResource) {
|
1592
|
1631
|
updateLargeVideo = true;
|
1593
|
1632
|
}
|
|
@@ -1618,7 +1657,10 @@ var VideoLayout = (function (my) {
|
1618
|
1657
|
|
1619
|
1658
|
// Don't fire the events again, they've already
|
1620
|
1659
|
// been fired in the contact list click handler.
|
1621
|
|
- VideoLayout.handleVideoThumbClicked($(sel).attr('src'), false, mediaStream.peerjid);
|
|
1660
|
+ VideoLayout.handleVideoThumbClicked(
|
|
1661
|
+ $(sel).attr('src'),
|
|
1662
|
+ false,
|
|
1663
|
+ Strophe.getResourceFromJid(mediaStream.peerjid));
|
1622
|
1664
|
|
1623
|
1665
|
updateLargeVideo = false;
|
1624
|
1666
|
}
|
|
@@ -1675,11 +1717,14 @@ var VideoLayout = (function (my) {
|
1675
|
1717
|
// Update the large video to the last added video only if there's no
|
1676
|
1718
|
// current dominant or focused speaker or update it to the current
|
1677
|
1719
|
// dominant speaker.
|
1678
|
|
- if ((!focusedVideoSrc && !VideoLayout.getDominantSpeakerResourceJid())
|
|
1720
|
+ if ((!focusedVideoInfo && !VideoLayout.getDominantSpeakerResourceJid())
|
1679
|
1721
|
|| (parentResourceJid
|
1680
|
1722
|
&& VideoLayout.getDominantSpeakerResourceJid()
|
1681
|
1723
|
=== parentResourceJid)) {
|
1682
|
|
- VideoLayout.updateLargeVideo(RTC.getVideoSrc(videoelem[0]), 1, parentResourceJid);
|
|
1724
|
+ VideoLayout.updateLargeVideo(
|
|
1725
|
+ RTC.getVideoSrc(videoelem[0]),
|
|
1726
|
+ 1,
|
|
1727
|
+ parentResourceJid);
|
1683
|
1728
|
}
|
1684
|
1729
|
|
1685
|
1730
|
VideoLayout.showModeratorIndicator();
|
|
@@ -1716,7 +1761,7 @@ var VideoLayout = (function (my) {
|
1716
|
1761
|
|
1717
|
1762
|
var msidParts = msid.split(' ');
|
1718
|
1763
|
|
1719
|
|
- var preload = (Strophe.getResourceFromJid(ssrc2jid[primarySSRC]) == largeVideoState.userJid);
|
|
1764
|
+ var preload = (Strophe.getResourceFromJid(ssrc2jid[primarySSRC]) == largeVideoState.userResourceJid);
|
1720
|
1765
|
|
1721
|
1766
|
if (preload) {
|
1722
|
1767
|
if (largeVideoState.preload)
|
|
@@ -1777,9 +1822,9 @@ var VideoLayout = (function (my) {
|
1777
|
1822
|
var selRemoteVideo = $(['#', 'remoteVideo_', session.sid, '_', msidParts[0]].join(''));
|
1778
|
1823
|
|
1779
|
1824
|
var updateLargeVideo = (Strophe.getResourceFromJid(ssrc2jid[primarySSRC])
|
1780
|
|
- == largeVideoState.userJid);
|
1781
|
|
- var updateFocusedVideoSrc = (focusedVideoSrc && focusedVideoSrc.src && focusedVideoSrc.src != '' &&
|
1782
|
|
- (RTC.getVideoSrc(selRemoteVideo[0]) == focusedVideoSrc.src));
|
|
1825
|
+ == largeVideoState.userResourceJid);
|
|
1826
|
+ var updateFocusedVideoSrc = (focusedVideoInfo && focusedVideoInfo.src && focusedVideoInfo.src != '' &&
|
|
1827
|
+ (RTC.getVideoSrc(selRemoteVideo[0]) == focusedVideoInfo.src));
|
1783
|
1828
|
|
1784
|
1829
|
var electedStreamUrl;
|
1785
|
1830
|
if (largeVideoState.preload_ssrc == primarySSRC)
|
|
@@ -1807,7 +1852,7 @@ var VideoLayout = (function (my) {
|
1807
|
1852
|
}
|
1808
|
1853
|
|
1809
|
1854
|
if (updateFocusedVideoSrc) {
|
1810
|
|
- focusedVideoSrc.src = RTC.getVideoSrc(selRemoteVideo[0]);
|
|
1855
|
+ focusedVideoInfo.src = RTC.getVideoSrc(selRemoteVideo[0]);
|
1811
|
1856
|
}
|
1812
|
1857
|
|
1813
|
1858
|
var videoId;
|