Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(media) Deprecate startScreenSharing config option for web browsers. This is no longer supported as per the w3c spec for getDisplayMedia.

Jaya Allamsetty64322db56a2f
diff --git a/conference.js b/conference.js
index 12746a39db..6612b57705 100644
--- a/conference.js
+++ b/conference.js
@@ -486,7 +486,7 @@ export default {
// Always get a handle on the audio input device so that we have statistics (such as "No audio input" or
// "Are you trying to speak?" ) even if the user joins the conference muted.
- const initialDevices = config.disableInitialGUM ? [] : [ 'audio' ];
+ const initialDevices = config.disableInitialGUM ? [] : [ MEDIA_TYPE.AUDIO ];
const requestedAudio = !config.disableInitialGUM;
let requestedVideo = false;
@@ -494,7 +494,7 @@ export default {
&& !options.startWithVideoMuted
&& !options.startAudioOnly
&& !options.startScreenSharing) {
- initialDevices.push('video');
+ initialDevices.push(MEDIA_TYPE.VIDEO);
requestedVideo = true;
}
@@ -518,21 +518,35 @@ export default {
// spend much time displaying the overlay screen. If GUM is not resolved within 15 seconds it will
// probably never resolve.
const timeout = browser.isElectron() ? 15000 : 60000;
+ const audioOptions = {
+ devices: [ MEDIA_TYPE.AUDIO ],
+ timeout,
+ firePermissionPromptIsShownEvent: true,
+ fireSlowPromiseEvent: true
+ };
// FIXME is there any simpler way to rewrite this spaghetti below ?
if (options.startScreenSharing) {
- tryCreateLocalTracks = this._createDesktopTrack()
+ // This option has been deprecated since it is no longer supported as per the w3c spec.
+ // https://w3c.github.io/mediacapture-screen-share/#dom-mediadevices-getdisplaymedia. If the user has not
+ // interacted with the webpage before the getDisplayMedia call, the promise will be rejected by the
+ // browser. This has already been implemented in Firefox and Safari and will be implemented in Chrome soon.
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1198918
+ // Please note that Spot uses the same config option to use an external video input device label as
+ // screenshare and calls getUserMedia instead of getDisplayMedia for capturing the media. Therefore it
+ // needs to be supported here if _desktopSharingSourceDevice is provided.
+ const errMessage = new Error('startScreenSharing config option is no longer supported for web browsers');
+ const desktopPromise = config._desktopSharingSourceDevice
+ ? this._createDesktopTrack()
+ : Promise.reject(errMessage);
+
+ tryCreateLocalTracks = desktopPromise
.then(([ desktopStream ]) => {
if (!requestedAudio) {
return [ desktopStream ];
}
- return createLocalTracksF({
- devices: [ 'audio' ],
- timeout,
- firePermissionPromptIsShownEvent: true,
- fireSlowPromiseEvent: true
- })
+ return createLocalTracksF(audioOptions)
.then(([ audioStream ]) =>
[ desktopStream, audioStream ])
.catch(error => {
@@ -545,14 +559,7 @@ export default {
logger.error('Failed to obtain desktop stream', error);
errors.screenSharingError = error;
- return requestedAudio
- ? createLocalTracksF({
- devices: [ 'audio' ],
- timeout,
- firePermissionPromptIsShownEvent: true,
- fireSlowPromiseEvent: true
- })
- : [];
+ return requestedAudio ? createLocalTracksF(audioOptions) : [];
})
.catch(error => {
errors.audioOnlyError = error;
@@ -587,13 +594,7 @@ export default {
return [];
}
- return (
- createLocalTracksF({
- devices: [ 'audio' ],
- timeout,
- firePermissionPromptIsShownEvent: true,
- fireSlowPromiseEvent: true
- }));
+ return createLocalTracksF(audioOptions);
} else if (requestedAudio && !requestedVideo) {
errors.audioOnlyError = err;
@@ -615,7 +616,7 @@ export default {
// Try video only...
return requestedVideo
? createLocalTracksF({
- devices: [ 'video' ],
+ devices: [ MEDIA_TYPE.VIDEO ],
firePermissionPromptIsShownEvent: true,
fireSlowPromiseEvent: true
})
diff --git a/config.js b/config.js
index fcff974a78..f4ea80840c 100644
--- a/config.js
+++ b/config.js
@@ -236,7 +236,11 @@ var config = {
// max: 5
// },
- // Try to start calls with screen-sharing instead of camera video.
+ // This option has been deprecated since it is no longer supported as per the w3c spec.
+ // https://w3c.github.io/mediacapture-screen-share/#dom-mediadevices-getdisplaymedia. If the user has not
+ // interacted with the webpage before the getDisplayMedia call, the promise will be rejected by the browser. This
+ // has already been implemented in Firefox and Safari and will be implemented in Chrome soon.
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1198918
// startScreenSharing: false,
// Recording