Browse Source

fix(screenshare): stop using exact for specified device sharing (#1031)

Overconstrainederror occurs when calling gum with "exact"
when on URLs with a hash. To get around this, remove
"exact". Add handling for specified device not being
found, as we can no longer rely on "exact". This
still leaves open the possibility of the wrong
camera being accessed.
dev1
virtuacoplenny 5 years ago
parent
commit
47c2bc6545
No account linked to committer's email address
1 changed files with 10 additions and 8 deletions
  1. 10
    8
      modules/RTC/RTCUtils.js

+ 10
- 8
modules/RTC/RTCUtils.js View File

@@ -1222,6 +1222,15 @@ class RTCUtils extends Listenable {
1222 1222
                         device.kind === 'videoinput'
1223 1223
                             && (device.deviceId === desktopSharingSourceDevice
1224 1224
                             || device.label === desktopSharingSourceDevice));
1225
+
1226
+                if (!matchingDevice) {
1227
+                    return Promise.reject(new JitsiTrackError(
1228
+                        { name: 'ConstraintNotSatisfiedError' },
1229
+                        {},
1230
+                        [ desktopSharingSourceDevice ]
1231
+                    ));
1232
+                }
1233
+
1225 1234
                 const requestedDevices = [ 'video' ];
1226 1235
 
1227 1236
                 // Leverage the helper used by {@link _newGetDesktopMedia} to
@@ -1229,17 +1238,10 @@ class RTCUtils extends Listenable {
1229 1238
                 const { gumOptions, trackOptions }
1230 1239
                     = this._parseDesktopSharingOptions(options);
1231 1240
 
1232
-                // Create a custom constraints object to use exact device
1233
-                // matching to make sure there is no fallthrough to another
1234
-                // camera device. If a matching device could not be found, try
1235
-                // anyways and let the caller handle errors.
1236 1241
                 const constraints = {
1237 1242
                     video: {
1238 1243
                         ...gumOptions,
1239
-                        deviceId: {
1240
-                            exact: (matchingDevice && matchingDevice.deviceId)
1241
-                                || desktopSharingSourceDevice
1242
-                        }
1244
+                        deviceId: matchingDevice.deviceId
1243 1245
                     }
1244 1246
                 };
1245 1247
 

Loading…
Cancel
Save