|
@@ -34,6 +34,8 @@ var eventEmitter = null;
|
34
|
34
|
*/
|
35
|
35
|
var focusedVideoResourceJid = null;
|
36
|
36
|
|
|
37
|
+const thumbAspectRatio = 16.0 / 9.0;
|
|
38
|
+
|
37
|
39
|
/**
|
38
|
40
|
* On contact list item clicked.
|
39
|
41
|
*/
|
|
@@ -153,7 +155,8 @@ var VideoLayout = {
|
153
|
155
|
let localId = APP.conference.localId;
|
154
|
156
|
this.onVideoTypeChanged(localId, stream.getType());
|
155
|
157
|
|
156
|
|
- AudioLevels.updateAudioLevelCanvas(null, VideoLayout);
|
|
158
|
+ let {thumbWidth, thumbHeight} = this.calculateThumbnailSize();
|
|
159
|
+ AudioLevels.updateAudioLevelCanvas(null, thumbWidth, thumbHeight);
|
157
|
160
|
|
158
|
161
|
localVideoThumbnail.changeVideo(stream);
|
159
|
162
|
|
|
@@ -215,9 +218,11 @@ var VideoLayout = {
|
215
|
218
|
electLastVisibleVideo () {
|
216
|
219
|
// pick the last visible video in the row
|
217
|
220
|
// if nobody else is left, this picks the local video
|
218
|
|
- let pick = $('#remoteVideos>span[id!="mixedstream"]:visible:last');
|
219
|
|
- if (pick.length) {
|
220
|
|
- let id = getPeerContainerResourceId(pick[0]);
|
|
221
|
+ let thumbs = BottomToolbar.getThumbs(true).filter('id!="mixedstream"');
|
|
222
|
+
|
|
223
|
+ let lastVisible = thumbs.filter(':visible:last');
|
|
224
|
+ if (lastVisible.length) {
|
|
225
|
+ let id = getPeerContainerResourceId(lastVisible[0]);
|
221
|
226
|
if (remoteVideos[id]) {
|
222
|
227
|
console.info("electLastVisibleVideo: " + id);
|
223
|
228
|
return id;
|
|
@@ -227,9 +232,9 @@ var VideoLayout = {
|
227
|
232
|
}
|
228
|
233
|
|
229
|
234
|
console.info("Last visible video no longer exists");
|
230
|
|
- pick = $('#remoteVideos>span[id!="mixedstream"]');
|
231
|
|
- if (pick.length) {
|
232
|
|
- let id = getPeerContainerResourceId(pick[0]);
|
|
235
|
+ thumbs = BottomToolbar.getThumbs();
|
|
236
|
+ if (thumbs.length) {
|
|
237
|
+ let id = getPeerContainerResourceId(thumbs[0]);
|
233
|
238
|
if (remoteVideos[id]) {
|
234
|
239
|
console.info("electLastVisibleVideo: " + id);
|
235
|
240
|
return id;
|
|
@@ -332,7 +337,7 @@ var VideoLayout = {
|
332
|
337
|
|
333
|
338
|
// In case this is not currently in the last n we don't show it.
|
334
|
339
|
if (localLastNCount && localLastNCount > 0 &&
|
335
|
|
- $('#remoteVideos>span').length >= localLastNCount + 2) {
|
|
340
|
+ BottomToolbar.getThumbs().length >= localLastNCount + 2) {
|
336
|
341
|
remoteVideo.showPeerContainer('hide');
|
337
|
342
|
} else {
|
338
|
343
|
VideoLayout.resizeThumbnails();
|
|
@@ -419,67 +424,53 @@ var VideoLayout = {
|
419
|
424
|
* Resizes thumbnails.
|
420
|
425
|
*/
|
421
|
426
|
resizeThumbnails (animate = false) {
|
422
|
|
- let videoSpaceWidth = $('#remoteVideos').width();
|
|
427
|
+ let {thumbWidth, thumbHeight} = this.calculateThumbnailSize();
|
423
|
428
|
|
424
|
|
- let [width, height] = this.calculateThumbnailSize(videoSpaceWidth);
|
|
429
|
+ $('.userAvatar').css('left', (thumbWidth - thumbHeight) / 2);
|
425
|
430
|
|
426
|
|
- $('.userAvatar').css('left', (width - height) / 2);
|
427
|
|
-
|
428
|
|
- $('#remoteVideos').animate({
|
429
|
|
- // adds 2 px because of small video 1px border
|
430
|
|
- height: height + 2
|
431
|
|
- }, {
|
432
|
|
- queue: false,
|
433
|
|
- duration: animate ? 500 : 0
|
434
|
|
- });
|
435
|
|
-
|
436
|
|
- $('#remoteVideos>span').animate({
|
437
|
|
- height, width
|
438
|
|
- }, {
|
439
|
|
- queue: false,
|
440
|
|
- duration: animate ? 500 : 0,
|
441
|
|
- complete: function () {
|
442
|
|
- BottomToolbar.onRemoteVideoResized(width, height);
|
443
|
|
- AudioLevels.onRemoteVideoResized(width, height);
|
444
|
|
- }
|
|
431
|
+ BottomToolbar.resizeThumbnails(thumbWidth, thumbHeight, animate).then(function () {
|
|
432
|
+ BottomToolbar.resizeToolbar(thumbWidth, thumbHeight);
|
|
433
|
+ AudioLevels.updateCanvasSize(thumbWidth, thumbHeight);
|
445
|
434
|
});
|
446
|
435
|
},
|
447
|
436
|
|
448
|
437
|
/**
|
449
|
438
|
* Calculates the thumbnail size.
|
450
|
439
|
*
|
451
|
|
- * @param videoSpaceWidth the width of the video space
|
452
|
440
|
*/
|
453
|
|
- calculateThumbnailSize (videoSpaceWidth) {
|
|
441
|
+ calculateThumbnailSize () {
|
|
442
|
+ let videoSpaceWidth = BottomToolbar.getFilmStripWidth();
|
454
|
443
|
// Calculate the available height, which is the inner window height
|
455
|
444
|
// minus 39px for the header minus 2px for the delimiter lines on the
|
456
|
445
|
// top and bottom of the large video, minus the 36px space inside the
|
457
|
446
|
// remoteVideos container used for highlighting shadow.
|
458
|
|
- var availableHeight = 100;
|
|
447
|
+ let availableHeight = 100;
|
459
|
448
|
|
460
|
|
- var numvids = $('#remoteVideos>span:visible').length;
|
|
449
|
+ let numvids = BottomToolbar.getThumbs().length;
|
461
|
450
|
if (localLastNCount && localLastNCount > 0) {
|
462
|
451
|
numvids = Math.min(localLastNCount + 1, numvids);
|
463
|
452
|
}
|
464
|
453
|
|
465
|
|
- // Remove the 3px borders arround videos and border around the remote
|
466
|
|
- // videos area and the 4 pixels between the local video and the others
|
467
|
|
- //TODO: Find out where the 4 pixels come from and remove them
|
468
|
|
- var availableWinWidth = videoSpaceWidth - 2 * 3 * numvids - 70 - 4;
|
|
454
|
+ // Remove the 3px borders arround videos and border around the remote
|
|
455
|
+ // videos area and the 4 pixels between the local video and the others
|
|
456
|
+ //TODO: Find out where the 4 pixels come from and remove them
|
|
457
|
+ let availableWinWidth = videoSpaceWidth - 2 * 3 * numvids - 70 - 4;
|
469
|
458
|
|
470
|
|
- var availableWidth = availableWinWidth / numvids;
|
471
|
|
- var aspectRatio = 16.0 / 9.0;
|
472
|
|
- var maxHeight = Math.min(160, availableHeight);
|
473
|
|
- availableHeight
|
474
|
|
- = Math.min( maxHeight,
|
475
|
|
- availableWidth / aspectRatio,
|
476
|
|
- window.innerHeight - 18);
|
|
459
|
+ let availableWidth = availableWinWidth / numvids;
|
|
460
|
+ let maxHeight = Math.min(160, availableHeight);
|
|
461
|
+ availableHeight
|
|
462
|
+ = Math.min( maxHeight,
|
|
463
|
+ availableWidth / thumbAspectRatio,
|
|
464
|
+ window.innerHeight - 18);
|
477
|
465
|
|
478
|
|
- if (availableHeight < availableWidth / aspectRatio) {
|
479
|
|
- availableWidth = Math.floor(availableHeight * aspectRatio);
|
480
|
|
- }
|
|
466
|
+ if (availableHeight < availableWidth / thumbAspectRatio) {
|
|
467
|
+ availableWidth = Math.floor(availableHeight * thumbAspectRatio);
|
|
468
|
+ }
|
481
|
469
|
|
482
|
|
- return [availableWidth, availableHeight];
|
|
470
|
+ return {
|
|
471
|
+ thumbWidth: availableWidth,
|
|
472
|
+ thumbHeight: availableHeight
|
|
473
|
+ };
|
483
|
474
|
},
|
484
|
475
|
|
485
|
476
|
/**
|
|
@@ -623,7 +614,7 @@ var VideoLayout = {
|
623
|
614
|
var updateLargeVideo = false;
|
624
|
615
|
|
625
|
616
|
// Handle LastN/local LastN changes.
|
626
|
|
- $('#remoteVideos>span').each(function( index, element ) {
|
|
617
|
+ BottomToolbar.getThumbs().each(function( index, element ) {
|
627
|
618
|
var resourceJid = getPeerContainerResourceId(element);
|
628
|
619
|
|
629
|
620
|
// We do not want to process any logic for our own(local) video
|