|
@@ -1034,22 +1034,9 @@ class RTCUtils extends Listenable {
|
1034
|
1034
|
new Error('Desktop sharing is not supported!'));
|
1035
|
1035
|
}
|
1036
|
1036
|
|
1037
|
|
- const {
|
1038
|
|
- desktopSharingExtensionExternalInstallation,
|
1039
|
|
- desktopSharingFrameRate,
|
1040
|
|
- desktopSharingSources
|
1041
|
|
- } = options;
|
1042
|
|
-
|
1043
|
1037
|
return new Promise((resolve, reject) => {
|
1044
|
1038
|
screenObtainer.obtainStream(
|
1045
|
|
- {
|
1046
|
|
- ...desktopSharingExtensionExternalInstallation,
|
1047
|
|
- desktopSharingSources,
|
1048
|
|
- gumOptions: {
|
1049
|
|
- frameRate: desktopSharingFrameRate
|
1050
|
|
- },
|
1051
|
|
- trackOptions: getTrackSSConstraints(options)
|
1052
|
|
- },
|
|
1039
|
+ this._parseDesktopSharingOptions(options),
|
1053
|
1040
|
stream => {
|
1054
|
1041
|
resolve(stream);
|
1055
|
1042
|
},
|
|
@@ -1310,23 +1297,40 @@ class RTCUtils extends Listenable {
|
1310
|
1297
|
device.kind === 'videoinput'
|
1311
|
1298
|
&& (device.deviceId === desktopSharingSourceDevice
|
1312
|
1299
|
|| device.label === desktopSharingSourceDevice));
|
1313
|
|
-
|
1314
|
1300
|
const requestedDevices = [ 'video' ];
|
1315
|
|
- const constraints = newGetConstraints(
|
1316
|
|
- requestedDevices, { options });
|
1317
|
|
-
|
1318
|
|
- // Use exact to make sure there is no fallthrough to another
|
1319
|
|
- // camera device. If a matching device could not be found,
|
1320
|
|
- // try anyways and let the caller handle errors.
|
1321
|
|
- constraints.video.deviceId = {
|
1322
|
|
- exact: (matchingDevice && matchingDevice.deviceId)
|
1323
|
|
- || desktopSharingSourceDevice
|
|
1301
|
+
|
|
1302
|
+ // Leverage the helper used by {@link _newGetDesktopMedia} to
|
|
1303
|
+ // get constraints for the desktop stream.
|
|
1304
|
+ const { gumOptions, trackOptions }
|
|
1305
|
+ = this._parseDesktopSharingOptions(options);
|
|
1306
|
+
|
|
1307
|
+ // Create a custom constraints object to use exact device
|
|
1308
|
+ // matching to make sure there is no fallthrough to another
|
|
1309
|
+ // camera device. If a matching device could not be found, try
|
|
1310
|
+ // anyways and let the caller handle errors.
|
|
1311
|
+ const constraints = {
|
|
1312
|
+ video: {
|
|
1313
|
+ ...gumOptions,
|
|
1314
|
+ deviceId: {
|
|
1315
|
+ exact: (matchingDevice && matchingDevice.deviceId)
|
|
1316
|
+ || desktopSharingSourceDevice
|
|
1317
|
+ }
|
|
1318
|
+ }
|
1324
|
1319
|
};
|
1325
|
1320
|
|
1326
|
1321
|
return this._newGetUserMediaWithConstraints(
|
1327
|
1322
|
requestedDevices, constraints)
|
1328
|
1323
|
.then(stream => {
|
1329
|
|
- return { stream };
|
|
1324
|
+ const track = stream && stream.getTracks()[0];
|
|
1325
|
+ const applyConstrainsPromise
|
|
1326
|
+ = track && track.applyConstraints
|
|
1327
|
+ ? track.applyConstraints(trackOptions)
|
|
1328
|
+ : Promise.resolve();
|
|
1329
|
+
|
|
1330
|
+ return applyConstrainsPromise
|
|
1331
|
+ .then(() => {
|
|
1332
|
+ return { stream };
|
|
1333
|
+ });
|
1330
|
1334
|
});
|
1331
|
1335
|
}
|
1332
|
1336
|
|