From a3cd33136956d238cb98493431d367630a45417f Mon Sep 17 00:00:00 2001 From: Jaya Allamsetty Date: Mon, 9 Dec 2019 16:48:53 -0500 Subject: [PATCH] fix: Workaround on FF for getting the resolution of the desktop track --- conference.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/conference.js b/conference.js index e9afc4dd1..ae024ffe4 100644 --- a/conference.js +++ b/conference.js @@ -1637,9 +1637,27 @@ export default { if (!this.localPresenterVideo && !mute) { // create a new presenter track and apply the presenter effect. - const { height } = this.localVideo.track.getSettings(); - const defaultCamera - = getUserSelectedCameraDeviceId(APP.store.getState()); + let { height } = this.localVideo.track.getSettings(); + + // Workaround for Firefox since it doesn't return the correct width/height of the desktop stream + // that is being currently shared. + if (!height || height === 0) { + const desktopResizeConstraints = { + width: 1280, + height: 720, + resizeMode: 'crop-and-scale' + }; + + try { + await this.localVideo.track.applyConstraints(desktopResizeConstraints); + } catch (err) { + logger.error('Failed to apply constraints on the desktop stream for presenter mode', err); + + return; + } + height = desktopResizeConstraints.height; + } + const defaultCamera = getUserSelectedCameraDeviceId(APP.store.getState()); let effect; try {