Skip to content

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

feat: add option to disable desktop sharing

paweldomasb84e910086ae
diff --git a/conference.js b/conference.js
index d46c43dbaf..8b46a51d95 100644
--- a/conference.js
+++ b/conference.js
@@ -544,7 +544,27 @@ export default {
audioMuted: false,
videoMuted: false,
isSharingScreen: false,
+ /**
+ * Indicates if the desktop sharing functionality has been enabled.
+ * It takes into consideration {@link isDesktopSharingDisabledByConfig}
+ * as well as the status returned by
+ * {@link JitsiMeetJS.isDesktopSharingEnabled()}. The latter can be false
+ * either if the desktop sharing is not supported by the current browser
+ * or if it was disabled through lib-jitsi-meet specific options (check
+ * config.js for listed options).
+ */
isDesktopSharingEnabled: false,
+ /**
+ * Set to <tt>true</tt> if the desktop sharing functionality has been
+ * explicitly disabled in the config.
+ */
+ isDesktopSharingDisabledByConfig: false,
+ /**
+ * The text displayed when the desktop sharing button is disabled through
+ * the config. The value is set through
+ * {@link interfaceConfig.DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP}.
+ */
+ desktopSharingDisabledTooltip: null,
/*
* Whether the local "raisedHand" flag is on.
*/
@@ -601,8 +621,15 @@ export default {
ConnectionEvents.CONNECTION_FAILED,
_connectionFailedHandler);
APP.connection = connection = con;
- this.isDesktopSharingEnabled =
- JitsiMeetJS.isDesktopSharingEnabled();
+
+ // Desktop sharing related stuff:
+ this.isDesktopSharingDisabledByConfig
+ = config.disableDesktopSharing;
+ this.isDesktopSharingEnabled
+ = !this.isDesktopSharingDisabledByConfig
+ && JitsiMeetJS.isDesktopSharingEnabled();
+ this.desktopSharingDisabledTooltip
+ = interfaceConfig.DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP;
eventEmitter.emit(
JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
this.isDesktopSharingEnabled);
diff --git a/config.js b/config.js
index 9d1c41367e..ff19c56deb 100644
--- a/config.js
+++ b/config.js
@@ -26,7 +26,10 @@ var config = { // eslint-disable-line no-unused-vars
clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
//focusUserJid: '[email protected]', // The real JID of focus participant - can be overridden here
//defaultSipNumber: '', // Default SIP number
-
+ /**
+ * Disables desktop sharing functionality.
+ */
+ disableDesktopSharing: false,
// The ID of the jidesha extension for Chrome.
desktopSharingChromeExtId: null,
// Whether desktop sharing should be disabled on Chrome.
diff --git a/interface_config.js b/interface_config.js
index d3be670a0a..4025536c5c 100644
--- a/interface_config.js
+++ b/interface_config.js
@@ -2,6 +2,12 @@ var interfaceConfig = { // eslint-disable-line no-unused-vars
// TO FIX: this needs to be handled from SASS variables. There are some
// methods allowing to use variables both in css and js.
DEFAULT_BACKGROUND: '#474747',
+ /**
+ * In case the desktop sharing is disabled through the config the button
+ * will not be hidden, but displayed as disabled with this text us as
+ * a tooltip.
+ */
+ DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP: null,
INITIAL_TOOLBAR_TIMEOUT: 20000,
TOOLBAR_TIMEOUT: 4000,
DEFAULT_REMOTE_DISPLAY_NAME: "Fellow Jitster",
diff --git a/modules/UI/util/UIUtil.js b/modules/UI/util/UIUtil.js
index 05fbcc65c3..6af9f024f9 100644
--- a/modules/UI/util/UIUtil.js
+++ b/modules/UI/util/UIUtil.js
@@ -167,6 +167,23 @@ const IndicatorFontSizes = {
}
},
+ /**
+ * Sets the tooltip to the given element, but instead of using translation
+ * key uses text value.
+ *
+ * @param element the element to set the tooltip to
+ * @param text the tooltip text
+ * @param position the position of the tooltip in relation to the element
+ */
+ setTooltipText(element, text, position) {
+ if (element) {
+ UIUtil.removeTooltip(element);
+
+ element.setAttribute('data-tooltip', TOOLTIP_POSITIONS[position]);
+ element.setAttribute('content', text);
+ }
+ },
+
/**
* Removes the tooltip to the given element.
*
diff --git a/react/features/toolbox/actions.web.js b/react/features/toolbox/actions.web.js
index cb754a37a5..18b53b232d 100644
--- a/react/features/toolbox/actions.web.js
+++ b/react/features/toolbox/actions.web.js
@@ -235,13 +235,22 @@ export function setProfileButtonUnclickable(unclickable: boolean): Function {
export function showDesktopSharingButton(): Function {
return (dispatch: Dispatch<*>) => {
const buttonName = 'desktop';
+ const disabledTooltipText
+ = APP.conference.desktopSharingDisabledTooltip;
+ const showTooltip
+ = disabledTooltipText
+ && APP.conference.isDesktopSharingDisabledByConfig;
const visible
- = APP.conference.isDesktopSharingEnabled
- && UIUtil.isButtonEnabled(buttonName);
+ = UIUtil.isButtonEnabled(buttonName)
+ && (APP.conference.isDesktopSharingEnabled || showTooltip);
- dispatch(setToolbarButton(buttonName, {
- hidden: !visible
- }));
+ const newState = {
+ enabled: APP.conference.isDesktopSharingEnabled,
+ hidden: !visible,
+ tooltipText: showTooltip ? disabledTooltipText : undefined
+ };
+
+ dispatch(setToolbarButton(buttonName, newState));
};
}
diff --git a/react/features/toolbox/components/ToolbarButton.web.js b/react/features/toolbox/components/ToolbarButton.web.js
index 7a3091221f..6c38c884e9 100644
--- a/react/features/toolbox/components/ToolbarButton.web.js
+++ b/react/features/toolbox/components/ToolbarButton.web.js
@@ -221,9 +221,15 @@ class ToolbarButton extends AbstractToolbarButton {
if (UIUtil.isButtonEnabled(name)) {
if (!button.unclickable) {
- UIUtil.setTooltip(this.button,
- button.tooltipKey,
- tooltipPosition);
+ if (button.tooltipText) {
+ UIUtil.setTooltipText(this.button,
+ button.tooltipText,
+ tooltipPosition);
+ } else {
+ UIUtil.setTooltip(this.button,
+ button.tooltipKey,
+ tooltipPosition);
+ }
}
if (button.shortcut) {
diff --git a/react/features/toolbox/functions.web.js b/react/features/toolbox/functions.web.js
index 9269785b1e..7128af1847 100644
--- a/react/features/toolbox/functions.web.js
+++ b/react/features/toolbox/functions.web.js
@@ -43,6 +43,10 @@ export function getButtonAttributesByProps(props: Object = {})
result.style = { display: 'none' };
}
+ if (props.tooltipText) {
+ result.content = props.tooltipText;
+ }
+
return result;
}