|
@@ -167,11 +167,13 @@ const ScreenObtainer = {
|
167
|
167
|
logger.info('Chrome extension not supported until ver 34');
|
168
|
168
|
|
169
|
169
|
return null;
|
|
170
|
+ } else if (browser.supportsGetDisplayMedia()
|
|
171
|
+ && !options.desktopSharingChromeDisabled) {
|
|
172
|
+
|
|
173
|
+ return this.obtainScreenFromGetDisplayMedia;
|
170
|
174
|
} else if (options.desktopSharingChromeDisabled
|
171
|
|
- || options.desktopSharingChromeMethod === false
|
172
|
175
|
|| !options.desktopSharingChromeExtId) {
|
173
|
176
|
|
174
|
|
- // TODO: desktopSharingChromeMethod is deprecated, remove.
|
175
|
177
|
return null;
|
176
|
178
|
}
|
177
|
179
|
|
|
@@ -193,15 +195,8 @@ const ScreenObtainer = {
|
193
|
195
|
}
|
194
|
196
|
|
195
|
197
|
return this.obtainScreenOnFirefox;
|
196
|
|
- } else if (browser.isEdge() && navigator.getDisplayMedia) {
|
197
|
|
- return (_, onSuccess, onFailure) => {
|
198
|
|
- navigator.getDisplayMedia({ video: true })
|
199
|
|
- .then(stream => onSuccess({
|
200
|
|
- stream,
|
201
|
|
- sourceId: stream.id
|
202
|
|
- }))
|
203
|
|
- .catch(onFailure);
|
204
|
|
- };
|
|
198
|
+ } else if (browser.isEdge() && browser.supportsGetDisplayMedia()) {
|
|
199
|
+ return this.obtainScreenFromGetDisplayMedia;
|
205
|
200
|
}
|
206
|
201
|
|
207
|
202
|
logger.log(
|
|
@@ -423,6 +418,37 @@ const ScreenObtainer = {
|
423
|
418
|
this.checkForChromeExtensionOnInterval(options,
|
424
|
419
|
streamCallback, failCallback);
|
425
|
420
|
});
|
|
421
|
+ },
|
|
422
|
+
|
|
423
|
+ /**
|
|
424
|
+ * Obtains a screen capture stream using getDisplayMedia.
|
|
425
|
+ *
|
|
426
|
+ * @param callback - The success callback.
|
|
427
|
+ * @param errorCallback - The error callback.
|
|
428
|
+ */
|
|
429
|
+ obtainScreenFromGetDisplayMedia(options, callback, errorCallback) {
|
|
430
|
+ navigator.getDisplayMedia({ video: true })
|
|
431
|
+ .then(stream => {
|
|
432
|
+ let applyConstraintsPromise;
|
|
433
|
+
|
|
434
|
+ if (stream
|
|
435
|
+ && stream.getTracks()
|
|
436
|
+ && stream.getTracks().length > 0) {
|
|
437
|
+ applyConstraintsPromise = stream.getTracks()[0]
|
|
438
|
+ .applyConstraints(options.trackOptions);
|
|
439
|
+ } else {
|
|
440
|
+ applyConstraintsPromise = Promise.resolve();
|
|
441
|
+ }
|
|
442
|
+
|
|
443
|
+ applyConstraintsPromise.then(() =>
|
|
444
|
+ callback({
|
|
445
|
+ stream,
|
|
446
|
+ sourceId: stream.id
|
|
447
|
+ }));
|
|
448
|
+ })
|
|
449
|
+ .catch(() =>
|
|
450
|
+ errorCallback(new JitsiTrackError(JitsiTrackErrors
|
|
451
|
+ .CHROME_EXTENSION_USER_CANCELED)));
|
426
|
452
|
}
|
427
|
453
|
};
|
428
|
454
|
|