瀏覽代碼

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.
master
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
 

Loading…
取消
儲存