fix(media) Deprecate startScreenSharing config option for web browsers.
This is no longer supported as per the w3c spec for getDisplayMedia.
This commit is contained in:
parent
b3c4fb6287
commit
64322db56a
|
@ -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
|
// 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.
|
// "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;
|
const requestedAudio = !config.disableInitialGUM;
|
||||||
let requestedVideo = false;
|
let requestedVideo = false;
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ export default {
|
||||||
&& !options.startWithVideoMuted
|
&& !options.startWithVideoMuted
|
||||||
&& !options.startAudioOnly
|
&& !options.startAudioOnly
|
||||||
&& !options.startScreenSharing) {
|
&& !options.startScreenSharing) {
|
||||||
initialDevices.push('video');
|
initialDevices.push(MEDIA_TYPE.VIDEO);
|
||||||
requestedVideo = true;
|
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
|
// spend much time displaying the overlay screen. If GUM is not resolved within 15 seconds it will
|
||||||
// probably never resolve.
|
// probably never resolve.
|
||||||
const timeout = browser.isElectron() ? 15000 : 60000;
|
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 ?
|
// FIXME is there any simpler way to rewrite this spaghetti below ?
|
||||||
if (options.startScreenSharing) {
|
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 ]) => {
|
.then(([ desktopStream ]) => {
|
||||||
if (!requestedAudio) {
|
if (!requestedAudio) {
|
||||||
return [ desktopStream ];
|
return [ desktopStream ];
|
||||||
}
|
}
|
||||||
|
|
||||||
return createLocalTracksF({
|
return createLocalTracksF(audioOptions)
|
||||||
devices: [ 'audio' ],
|
|
||||||
timeout,
|
|
||||||
firePermissionPromptIsShownEvent: true,
|
|
||||||
fireSlowPromiseEvent: true
|
|
||||||
})
|
|
||||||
.then(([ audioStream ]) =>
|
.then(([ audioStream ]) =>
|
||||||
[ desktopStream, audioStream ])
|
[ desktopStream, audioStream ])
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -545,14 +559,7 @@ export default {
|
||||||
logger.error('Failed to obtain desktop stream', error);
|
logger.error('Failed to obtain desktop stream', error);
|
||||||
errors.screenSharingError = error;
|
errors.screenSharingError = error;
|
||||||
|
|
||||||
return requestedAudio
|
return requestedAudio ? createLocalTracksF(audioOptions) : [];
|
||||||
? createLocalTracksF({
|
|
||||||
devices: [ 'audio' ],
|
|
||||||
timeout,
|
|
||||||
firePermissionPromptIsShownEvent: true,
|
|
||||||
fireSlowPromiseEvent: true
|
|
||||||
})
|
|
||||||
: [];
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
errors.audioOnlyError = error;
|
errors.audioOnlyError = error;
|
||||||
|
@ -587,13 +594,7 @@ export default {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return createLocalTracksF(audioOptions);
|
||||||
createLocalTracksF({
|
|
||||||
devices: [ 'audio' ],
|
|
||||||
timeout,
|
|
||||||
firePermissionPromptIsShownEvent: true,
|
|
||||||
fireSlowPromiseEvent: true
|
|
||||||
}));
|
|
||||||
} else if (requestedAudio && !requestedVideo) {
|
} else if (requestedAudio && !requestedVideo) {
|
||||||
errors.audioOnlyError = err;
|
errors.audioOnlyError = err;
|
||||||
|
|
||||||
|
@ -615,7 +616,7 @@ export default {
|
||||||
// Try video only...
|
// Try video only...
|
||||||
return requestedVideo
|
return requestedVideo
|
||||||
? createLocalTracksF({
|
? createLocalTracksF({
|
||||||
devices: [ 'video' ],
|
devices: [ MEDIA_TYPE.VIDEO ],
|
||||||
firePermissionPromptIsShownEvent: true,
|
firePermissionPromptIsShownEvent: true,
|
||||||
fireSlowPromiseEvent: true
|
fireSlowPromiseEvent: true
|
||||||
})
|
})
|
||||||
|
|
|
@ -236,7 +236,11 @@ var config = {
|
||||||
// max: 5
|
// 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,
|
// startScreenSharing: false,
|
||||||
|
|
||||||
// Recording
|
// Recording
|
||||||
|
|
Loading…
Reference in New Issue