From 7f17c2eceb6f4f8c09893d98be7a8d8bf9a1dba6 Mon Sep 17 00:00:00 2001 From: paweldomas <2965063+paweldomas@users.noreply.github.com> Date: Wed, 23 Sep 2020 11:04:35 -0500 Subject: [PATCH] fix(LargeVideoManager): large video resizing Distinguish between preferred and calculated width/height values. --- modules/UI/videolayout/LargeVideoManager.js | 34 +++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/modules/UI/videolayout/LargeVideoManager.js b/modules/UI/videolayout/LargeVideoManager.js index 8b51a5ff9..c2629b4d1 100644 --- a/modules/UI/videolayout/LargeVideoManager.js +++ b/modules/UI/videolayout/LargeVideoManager.js @@ -67,7 +67,30 @@ export default class LargeVideoManager { // use the same video container to handle desktop tracks this.addContainer(DESKTOP_CONTAINER_TYPE, this.videoContainer); + /** + * The preferred width passed as an argument to {@link updateContainerSize}. + * + * @type {number|undefined} + */ + this.preferredWidth = undefined; + + /** + * The preferred height passed as an argument to {@link updateContainerSize}. + * + * @type {number|undefined} + */ + this.preferredHeight = undefined; + + /** + * The calculated width that will be used for the large video. + * @type {number} + */ this.width = 0; + + /** + * The calculated height that will be used for the large video. + * @type {number} + */ this.height = 0; /** @@ -323,7 +346,14 @@ export default class LargeVideoManager { * Update container size. */ updateContainerSize(width, height) { - let widthToUse = width ?? (this.width > 0 ? this.width : window.innerWidth); + if (typeof width === 'number') { + this.preferredWidth = width; + } + if (typeof height === 'number') { + this.preferredHeight = height; + } + + let widthToUse = this.preferredWidth || window.innerWidth; const { isOpen } = APP.store.getState()['features/chat']; /** @@ -340,7 +370,7 @@ export default class LargeVideoManager { } this.width = widthToUse; - this.height = height ?? (this.height > 0 ? this.height : window.innerHeight); + this.height = this.preferredHeight || window.innerHeight; } /**