Browse Source

fix: Workaround on FF for getting the resolution of the desktop track

j8
Jaya Allamsetty 5 years ago
parent
commit
a3cd331369
1 changed files with 21 additions and 3 deletions
  1. 21
    3
      conference.js

+ 21
- 3
conference.js View File

1637
 
1637
 
1638
         if (!this.localPresenterVideo && !mute) {
1638
         if (!this.localPresenterVideo && !mute) {
1639
             // create a new presenter track and apply the presenter effect.
1639
             // create a new presenter track and apply the presenter effect.
1640
-            const { height } = this.localVideo.track.getSettings();
1641
-            const defaultCamera
1642
-                = getUserSelectedCameraDeviceId(APP.store.getState());
1640
+            let { height } = this.localVideo.track.getSettings();
1641
+
1642
+            // Workaround for Firefox since it doesn't return the correct width/height of the desktop stream
1643
+            // that is being currently shared.
1644
+            if (!height || height === 0) {
1645
+                const desktopResizeConstraints = {
1646
+                    width: 1280,
1647
+                    height: 720,
1648
+                    resizeMode: 'crop-and-scale'
1649
+                };
1650
+
1651
+                try {
1652
+                    await this.localVideo.track.applyConstraints(desktopResizeConstraints);
1653
+                } catch (err) {
1654
+                    logger.error('Failed to apply constraints on the desktop stream for presenter mode', err);
1655
+
1656
+                    return;
1657
+                }
1658
+                height = desktopResizeConstraints.height;
1659
+            }
1660
+            const defaultCamera = getUserSelectedCameraDeviceId(APP.store.getState());
1643
             let effect;
1661
             let effect;
1644
 
1662
 
1645
             try {
1663
             try {

Loading…
Cancel
Save