소스 검색

fix(large-video): missing video.

master
Hristo Terezov 6 년 전
부모
커밋
f3f936c196
3개의 변경된 파일35개의 추가작업 그리고 24개의 파일을 삭제
  1. 3
    3
      modules/UI/videolayout/LargeVideoManager.js
  2. 32
    12
      modules/UI/videolayout/VideoContainer.js
  3. 0
    9
      modules/UI/videolayout/VideoLayout.js

+ 3
- 3
modules/UI/videolayout/LargeVideoManager.js 파일 보기

@@ -683,8 +683,8 @@ export default class LargeVideoManager {
683 683
     }
684 684
 
685 685
     /**
686
-     * Dispatches an action to update the known resolution state of the
687
-     * large video and adjusts container sizes when the resolution changes.
686
+     * Dispatches an action to update the known resolution state of the large video and adjusts container sizes when the
687
+     * resolution changes.
688 688
      *
689 689
      * @private
690 690
      * @returns {void}
@@ -697,7 +697,7 @@ export default class LargeVideoManager {
697 697
             APP.store.dispatch(updateKnownLargeVideoResolution(height));
698 698
         }
699 699
 
700
-        const currentAspectRatio = width / height;
700
+        const currentAspectRatio = height === 0 ? 0 : width / height;
701 701
 
702 702
         if (this._videoAspectRatio !== currentAspectRatio) {
703 703
             this._videoAspectRatio = currentAspectRatio;

+ 32
- 12
modules/UI/videolayout/VideoContainer.js 파일 보기

@@ -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);

+ 0
- 9
modules/UI/videolayout/VideoLayout.js 파일 보기

@@ -22,7 +22,6 @@ import SharedVideoThumb from '../shared_video/SharedVideoThumb';
22 22
 
23 23
 import Filmstrip from './Filmstrip';
24 24
 import UIEvents from '../../../service/UI/UIEvents';
25
-import UIUtil from '../util/UIUtil';
26 25
 
27 26
 import RemoteVideo from './RemoteVideo';
28 27
 import LargeVideoManager from './LargeVideoManager';
@@ -663,14 +662,6 @@ const VideoLayout = {
663 662
             largeVideo.updateContainerSize();
664 663
             largeVideo.resize(animate);
665 664
         }
666
-
667
-        // Calculate available width and height.
668
-        const availableHeight = window.innerHeight;
669
-        const availableWidth = UIUtil.getAvailableVideoWidth();
670
-
671
-        if (availableWidth < 0 || availableHeight < 0) {
672
-            return;
673
-        }
674 665
     },
675 666
 
676 667
     getSmallVideo(id) {

Loading…
취소
저장