From 69dfa301428835a20d98237e78c4de221db1aa97 Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Thu, 10 Jan 2019 15:39:17 -0800 Subject: [PATCH] feat(screenshare): use camera as a screenshare source This feature is intended for spot. Spot can have an HDMI -> usb adapter hooked up to it. In that case, attempting to screenshare should use that adapter as a screensharing source. Jitsi-Meet should pass a configured screenshare source into lib-jitsi-meet so it can be used as a source. --- conference.js | 6 ++++++ config.js | 7 +++++++ react/features/base/config/functions.js | 1 + react/features/base/tracks/functions.js | 2 ++ 4 files changed, 16 insertions(+) diff --git a/conference.js b/conference.js index 8ab94c3e32..9541247497 100644 --- a/conference.js +++ b/conference.js @@ -1488,6 +1488,8 @@ export default { const wasVideoMuted = this.isLocalVideoMuted(); return createLocalTracksF({ + desktopSharingSourceDevice: options.desktopSharingSources + ? null : config._desktopSharingSourceDevice, desktopSharingSources: options.desktopSharingSources, devices: [ 'desktop' ], desktopSharingExtensionExternalInstallation: { @@ -1645,6 +1647,7 @@ export default { // Handling: // JitsiTrackErrors.PERMISSION_DENIED // JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR + // JitsiTrackErrors.CONSTRAINT_FAILED // JitsiTrackErrors.GENERAL // and any other let descriptionKey; @@ -1668,6 +1671,9 @@ export default { descriptionKey = 'dialog.screenSharingPermissionDeniedError'; titleKey = 'dialog.screenSharingFailedToInstallTitle'; } + } else if (error.name === JitsiTrackErrors.CONSTRAINT_FAILED) { + descriptionKey = 'dialog.cameraConstraintFailedError'; + titleKey = 'deviceError.cameraError'; } else { descriptionKey = 'dialog.screenSharingFailedToInstall'; titleKey = 'dialog.screenSharingFailedToInstallTitle'; diff --git a/config.js b/config.js index db70da9b96..1f51e361ff 100644 --- a/config.js +++ b/config.js @@ -386,6 +386,13 @@ var config = { // analyticsInterval: 60000, // } + // If set, will attempt to use the provided video input device label when + // triggering a screenshare, instead of proceeding through the normal flow + // for obtaining a desktop stream. + // NOTE: This option is experimental and is currently intended for internal + // use only. + // _desktopSharingSourceDevice: 'sample-id-or-label' + // List of undocumented settings used in jitsi-meet /** _immediateReloadThreshold diff --git a/react/features/base/config/functions.js b/react/features/base/config/functions.js index 48b5c4388e..348c00284f 100644 --- a/react/features/base/config/functions.js +++ b/react/features/base/config/functions.js @@ -17,6 +17,7 @@ declare var $: Object; * @type Array */ const WHITELISTED_KEYS = [ + '_desktopSharingSourceDevice', '_peerConnStatusOutOfLastNTimeout', '_peerConnStatusRtcMuteTimeout', 'abTesting', diff --git a/react/features/base/tracks/functions.js b/react/features/base/tracks/functions.js index 2af87c71b9..f8424bb626 100644 --- a/react/features/base/tracks/functions.js +++ b/react/features/base/tracks/functions.js @@ -62,6 +62,8 @@ export function createLocalTracksF( desktopSharingExtensionExternalInstallation: options.desktopSharingExtensionExternalInstallation, desktopSharingFrameRate, + desktopSharingSourceDevice: + options.desktopSharingSourceDevice, desktopSharingSources: options.desktopSharingSources, // Copy array to avoid mutations inside library.