fix(LargeVideoManager): large video resizing

Distinguish between preferred and calculated width/height
values.
This commit is contained in:
paweldomas 2020-09-23 11:04:35 -05:00 committed by Jaya Allamsetty
parent 09124ad7e9
commit 7f17c2eceb
1 changed files with 32 additions and 2 deletions

View File

@ -67,7 +67,30 @@ export default class LargeVideoManager {
// use the same video container to handle desktop tracks // use the same video container to handle desktop tracks
this.addContainer(DESKTOP_CONTAINER_TYPE, this.videoContainer); 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; this.width = 0;
/**
* The calculated height that will be used for the large video.
* @type {number}
*/
this.height = 0; this.height = 0;
/** /**
@ -323,7 +346,14 @@ export default class LargeVideoManager {
* Update container size. * Update container size.
*/ */
updateContainerSize(width, height) { 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']; const { isOpen } = APP.store.getState()['features/chat'];
/** /**
@ -340,7 +370,7 @@ export default class LargeVideoManager {
} }
this.width = widthToUse; this.width = widthToUse;
this.height = height ?? (this.height > 0 ? this.height : window.innerHeight); this.height = this.preferredHeight || window.innerHeight;
} }
/** /**