浏览代码

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 年前
父节点
当前提交
47c2bc6545
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 10 次插入8 次删除
  1. 10
    8
      modules/RTC/RTCUtils.js

+ 10
- 8
modules/RTC/RTCUtils.js 查看文件

1222
                         device.kind === 'videoinput'
1222
                         device.kind === 'videoinput'
1223
                             && (device.deviceId === desktopSharingSourceDevice
1223
                             && (device.deviceId === desktopSharingSourceDevice
1224
                             || device.label === desktopSharingSourceDevice));
1224
                             || device.label === desktopSharingSourceDevice));
1225
+
1226
+                if (!matchingDevice) {
1227
+                    return Promise.reject(new JitsiTrackError(
1228
+                        { name: 'ConstraintNotSatisfiedError' },
1229
+                        {},
1230
+                        [ desktopSharingSourceDevice ]
1231
+                    ));
1232
+                }
1233
+
1225
                 const requestedDevices = [ 'video' ];
1234
                 const requestedDevices = [ 'video' ];
1226
 
1235
 
1227
                 // Leverage the helper used by {@link _newGetDesktopMedia} to
1236
                 // Leverage the helper used by {@link _newGetDesktopMedia} to
1229
                 const { gumOptions, trackOptions }
1238
                 const { gumOptions, trackOptions }
1230
                     = this._parseDesktopSharingOptions(options);
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
                 const constraints = {
1241
                 const constraints = {
1237
                     video: {
1242
                     video: {
1238
                         ...gumOptions,
1243
                         ...gumOptions,
1239
-                        deviceId: {
1240
-                            exact: (matchingDevice && matchingDevice.deviceId)
1241
-                                || desktopSharingSourceDevice
1242
-                        }
1244
+                        deviceId: matchingDevice.deviceId
1243
                     }
1245
                     }
1244
                 };
1246
                 };
1245
 
1247
 

正在加载...
取消
保存