diff --git a/conference.js b/conference.js index d7670f9df809..25e78811a6ee 100644 --- a/conference.js +++ b/conference.js @@ -175,6 +175,7 @@ let room; * lib-jitsi-meet to detect and invoke */ window.JitsiMeetScreenObtainer = { + gDMSupported: true, openDesktopPicker(options, onSourceChoose) { APP.store.dispatch(showDesktopPicker(options, onSourceChoose)); } diff --git a/modules/API/API.js b/modules/API/API.js index f1c62859e563..d6c81b5f0d48 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -75,6 +75,7 @@ import { toggleChat } from '../../react/features/chat/actions'; import { openChat } from '../../react/features/chat/actions.web'; +import { showDesktopPicker } from '../../react/features/desktop-picker/actions'; import { processExternalDeviceRequest } from '../../react/features/device-selection/functions'; @@ -1046,8 +1047,20 @@ function initCommands() { callback(conference?.getMeetingUniqueId() || ''); break; } - case '_new_electron_screensharing_supported': { - callback(true); + case 'open-desktop-picker': { + const { desktopSharingSources } = APP.store.getState()['features/base/config']; + const options = { + desktopSharingSources: desktopSharingSources ?? [ 'screen', 'window' ] + }; + const onSourceChoose = (streamId, _, screenShareAudio) => { + callback({ + streamId, + screenShareAudio + }); + }; + + dispatch(showDesktopPicker(options, onSourceChoose)); + break; } default: diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js index 9d2f64e9d937..03dca7d874a3 100644 --- a/modules/API/external/external_api.js +++ b/modules/API/external/external_api.js @@ -1237,21 +1237,6 @@ export default class JitsiMeetExternalAPI extends EventEmitter { }); } - /** - * Returns the state of availability electron share screen via external api. - * - * @returns {Promise} - * - * TODO: should be removed after we make sure that all Electron clients use only versions - * after with the legacy SS suport was removed from the electron SDK. If we remove it now the SS for Electron - * clients with older versions wont work. - */ - _isNewElectronScreensharingSupported() { - return this._transport.sendRequest({ - name: '_new_electron_screensharing_supported' - }); - } - /** * Pins a participant's video on to the stage view. * @@ -1455,4 +1440,15 @@ export default class JitsiMeetExternalAPI extends EventEmitter { setVirtualBackground(enabled, backgroundImage) { this.executeCommand('setVirtualBackground', enabled, backgroundImage); } + + /** + * Opens the desktop picker. This is invoked by the Electron SDK when gDM is used. + * + * @returns {Promise} + */ + _openDesktopPicker() { + return this._transport.sendRequest({ + name: 'open-desktop-picker' + }); + } }