Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat: New config disable feature virtual background (#13580)
Javier García7a305ef96e00
diff --git a/config.js b/config.jsindex 2d2740e4de..d121683592 100644--- a/config.js+++ b/config.js@@ -1306,6 +1306,9 @@ var config = {// hideJoinRoomButton: false,// },+ // When true, virtual background feature will be disabled.+ // disableVirtualBackground: false,+// When true the user cannot add more images to be used as virtual background.// Only the default ones from will be available.// disableAddingBackgroundImages: false,diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.tsindex 8a6fd0fc2e..c2b3cbbb69 100644--- a/react/features/base/config/configType.ts+++ b/react/features/base/config/configType.ts@@ -283,6 +283,7 @@ export interface IConfig {disableThirdPartyRequests?: boolean;disableTileEnlargement?: boolean;disableTileView?: boolean;+ disableVirtualBackground?: boolean;disabledNotifications?: Array<string>;disabledSounds?: Array<Sounds>;doNotFlipLocalVideo?: boolean;diff --git a/react/features/settings/components/web/SettingsDialog.tsx b/react/features/settings/components/web/SettingsDialog.tsxindex 9e79b30671..edfe81bb7a 100644--- a/react/features/settings/components/web/SettingsDialog.tsx+++ b/react/features/settings/components/web/SettingsDialog.tsx@@ -23,7 +23,7 @@ import {getAudioDeviceSelectionDialogProps,getVideoDeviceSelectionDialogProps} from '../../../device-selection/functions.web';-import { checkBlurSupport } from '../../../virtual-background/functions';+import { checkBlurSupport, checkVirtualBackgroundEnabled } from '../../../virtual-background/functions';import { iAmVisitor } from '../../../visitors/functions';import {submitModeratorTab,@@ -141,6 +141,7 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {const enabledNotifications = getNotificationsMap(state);const showNotificationsSettings = Object.keys(enabledNotifications).length > 0;const virtualBackgroundSupported = checkBlurSupport();+ const enableVirtualBackground = checkVirtualBackgroundEnabled(state);const tabs: IDialogTab<any>[] = [];const _iAmVisitor = iAmVisitor(state);@@ -191,7 +192,7 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {});}- if (virtualBackgroundSupported && !_iAmVisitor) {+ if (virtualBackgroundSupported && !_iAmVisitor && enableVirtualBackground) {tabs.push({name: SETTINGS_TABS.VIRTUAL_BACKGROUND,component: VirtualBackgroundTab,diff --git a/react/features/virtual-background/components/VideoBackgroundButton.ts b/react/features/virtual-background/components/VideoBackgroundButton.tsindex 5828022ff0..e0bd26e6b2 100644--- a/react/features/virtual-background/components/VideoBackgroundButton.ts+++ b/react/features/virtual-background/components/VideoBackgroundButton.ts@@ -8,7 +8,7 @@ import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolboimport { isScreenVideoShared } from '../../screen-share/functions';import { openSettingsDialog } from '../../settings/actions';import { SETTINGS_TABS } from '../../settings/constants';-import { checkBlurSupport } from '../functions';+import { checkBlurSupport, checkVirtualBackgroundEnabled } from '../functions';/*** The type of the React {@code Component} props of {@link VideoBackgroundButton}.@@ -69,7 +69,10 @@ function _mapStateToProps(state: IReduxState) {return {_isBackgroundEnabled: Boolean(state['features/virtual-background'].backgroundEffectEnabled),- visible: checkBlurSupport() && getMultipleVideoSendingSupportFeatureFlag(state) && !isScreenVideoShared(state)+ visible: checkBlurSupport()+ && getMultipleVideoSendingSupportFeatureFlag(state)+ && !isScreenVideoShared(state)+ && checkVirtualBackgroundEnabled(state)};}diff --git a/react/features/virtual-background/functions.ts b/react/features/virtual-background/functions.tsindex af64d0fc90..099ea04991 100644--- a/react/features/virtual-background/functions.ts+++ b/react/features/virtual-background/functions.ts@@ -1,3 +1,5 @@+import { IReduxState } from '../app/types';+let filterSupport: boolean | undefined;/**@@ -18,6 +20,16 @@ export function checkBlurSupport() {return filterSupport;}+/**+ * Checks if virtual background is enabled.+ *+ * @param {IReduxState} state - The state of the app.+ * @returns {boolean} True if virtual background is enabled and false if virtual background is disabled.+ */+export function checkVirtualBackgroundEnabled(state: IReduxState) {+ return state['features/base/config'].disableVirtualBackground !== true;+}+/*** Convert blob to base64.*