|
@@ -5,10 +5,8 @@ import React from 'react';
|
5
|
5
|
import ReactDOM from 'react-dom';
|
6
|
6
|
|
7
|
7
|
import { browser } from '../../../react/features/base/lib-jitsi-meet';
|
8
|
|
-import {
|
9
|
|
- ORIENTATION,
|
10
|
|
- LargeVideoBackground
|
11
|
|
-} from '../../../react/features/large-video';
|
|
8
|
+import { ORIENTATION, LargeVideoBackground } from '../../../react/features/large-video';
|
|
9
|
+import { LAYOUTS, getCurrentLayout } from '../../../react/features/video-layout';
|
12
|
10
|
/* eslint-enable no-unused-vars */
|
13
|
11
|
|
14
|
12
|
import Filmstrip from './Filmstrip';
|
|
@@ -55,8 +53,12 @@ function computeDesktopVideoSize( // eslint-disable-line max-params
|
55
|
53
|
videoHeight,
|
56
|
54
|
videoSpaceWidth,
|
57
|
55
|
videoSpaceHeight) {
|
58
|
|
- const aspectRatio = videoWidth / videoHeight;
|
|
56
|
+ if (videoWidth === 0 || videoHeight === 0 || videoSpaceWidth === 0 || videoSpaceHeight === 0) {
|
|
57
|
+ // Avoid NaN values caused by devision by 0.
|
|
58
|
+ return [ 0, 0 ];
|
|
59
|
+ }
|
59
|
60
|
|
|
61
|
+ const aspectRatio = videoWidth / videoHeight;
|
60
|
62
|
let availableWidth = Math.max(videoWidth, videoSpaceWidth);
|
61
|
63
|
let availableHeight = Math.max(videoHeight, videoSpaceHeight);
|
62
|
64
|
|
|
@@ -99,6 +101,11 @@ function computeCameraVideoSize( // eslint-disable-line max-params
|
99
|
101
|
videoSpaceWidth,
|
100
|
102
|
videoSpaceHeight,
|
101
|
103
|
videoLayoutFit) {
|
|
104
|
+ if (videoWidth === 0 || videoHeight === 0 || videoSpaceWidth === 0 || videoSpaceHeight === 0) {
|
|
105
|
+ // Avoid NaN values caused by devision by 0.
|
|
106
|
+ return [ 0, 0 ];
|
|
107
|
+ }
|
|
108
|
+
|
102
|
109
|
const aspectRatio = videoWidth / videoHeight;
|
103
|
110
|
|
104
|
111
|
switch (videoLayoutFit) {
|
|
@@ -322,7 +329,7 @@ export class VideoContainer extends LargeContainer {
|
322
|
329
|
* @param {number} containerHeight container height
|
323
|
330
|
* @returns {{availableWidth, availableHeight}}
|
324
|
331
|
*/
|
325
|
|
- getVideoSize(containerWidth, containerHeight) {
|
|
332
|
+ _getVideoSize(containerWidth, containerHeight) {
|
326
|
333
|
const { width, height } = this.getStreamSize();
|
327
|
334
|
|
328
|
335
|
if (this.stream && this.isScreenSharing()) {
|
|
@@ -414,13 +421,27 @@ export class VideoContainer extends LargeContainer {
|
414
|
421
|
if (this.$video.length === 0) {
|
415
|
422
|
return;
|
416
|
423
|
}
|
|
424
|
+ const currentLayout = getCurrentLayout(APP.store.getState());
|
|
425
|
+
|
|
426
|
+ if (currentLayout === LAYOUTS.TILE_VIEW) {
|
|
427
|
+ // We don't need to resize the large video since it won't be displayed and we'll resize when returning back
|
|
428
|
+ // to stage view.
|
|
429
|
+ return;
|
|
430
|
+ }
|
|
431
|
+
|
|
432
|
+ const [ width, height ] = this._getVideoSize(containerWidth, containerHeight);
|
417
|
433
|
|
418
|
|
- const [ width, height ]
|
419
|
|
- = this.getVideoSize(containerWidth, containerHeight);
|
|
434
|
+ if (width === 0 || height === 0) {
|
|
435
|
+ // We don't need to set 0 for width or height since the visibility is controled by the visibility css prop
|
|
436
|
+ // on the largeVideoElementsContainer. Also if the width/height of the video element is 0 the attached
|
|
437
|
+ // stream won't be played. Normally if we attach a new stream we won't resize the video element until the
|
|
438
|
+ // stream has been played. But setting width/height to 0 will prevent the video from playing.
|
|
439
|
+
|
|
440
|
+ return;
|
|
441
|
+ }
|
420
|
442
|
|
421
|
443
|
if ((containerWidth > width) || (containerHeight > height)) {
|
422
|
|
- this._backgroundOrientation = containerWidth > width
|
423
|
|
- ? ORIENTATION.LANDSCAPE : ORIENTATION.PORTRAIT;
|
|
444
|
+ this._backgroundOrientation = containerWidth > width ? ORIENTATION.LANDSCAPE : ORIENTATION.PORTRAIT;
|
424
|
445
|
this._hideBackground = false;
|
425
|
446
|
} else {
|
426
|
447
|
this._hideBackground = true;
|
|
@@ -429,8 +450,7 @@ export class VideoContainer extends LargeContainer {
|
429
|
450
|
this._updateBackground();
|
430
|
451
|
|
431
|
452
|
const { horizontalIndent, verticalIndent }
|
432
|
|
- = this.getVideoPosition(width, height,
|
433
|
|
- containerWidth, containerHeight);
|
|
453
|
+ = this.getVideoPosition(width, height, containerWidth, containerHeight);
|
434
|
454
|
|
435
|
455
|
// update avatar position
|
436
|
456
|
const top = (containerHeight / 2) - (this.avatarHeight / 4 * 3);
|