Skip to content

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

fix(virtual-background): show notification when background limit is reached (#17053)

Yash Rastogi33679ac16362
diff --git a/lang/main.json b/lang/main.json
index 318c1a8d05..72db321fef 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -1604,6 +1604,7 @@
"addBackground": "Add background",
"apply": "Apply",
"backgroundEffectError": "Failed to apply background effect.",
+ "backgroundLimitReached": "Custom background limit reached",
"blur": "Blur",
"deleteImage": "Delete image",
"desktopShare": "Desktop share",
@@ -1616,6 +1617,7 @@
"image6": "Forest ",
"image7": "Sunrise",
"none": "None",
+ "oldestBackgroundRemoved": "The oldest custom background has been removed to add the new one.",
"pleaseWait": "Please wait…",
"removeBackground": "Remove background",
"slightBlur": "Half Blur",
diff --git a/react/features/virtual-background/components/VirtualBackgrounds.tsx b/react/features/virtual-background/components/VirtualBackgrounds.tsx
index 23038381b4..5561727ef7 100644
--- a/react/features/virtual-background/components/VirtualBackgrounds.tsx
+++ b/react/features/virtual-background/components/VirtualBackgrounds.tsx
@@ -14,6 +14,8 @@ import Icon from '../../base/icons/components/Icon';
import { IconCloseLarge } from '../../base/icons/svg';
import Tooltip from '../../base/tooltip/components/Tooltip';
import Spinner from '../../base/ui/components/web/Spinner';
+import { showWarningNotification } from '../../notifications/actions';
+import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
import { BACKGROUNDS_LIMIT, IMAGES, type Image, VIRTUAL_BACKGROUND_TYPE } from '../constants';
import { toDataURL } from '../functions';
import logger from '../logger';
@@ -184,6 +186,7 @@ function VirtualBackgrounds({
onOptionsChange,
options,
selectedVideoInputId,
+ dispatch,
t
}: IProps) {
const { classes, cx } = useStyles();
@@ -216,9 +219,13 @@ function VirtualBackgrounds({
err && setStoredImages(storedImages.slice(1));
}
if (storedImages.length === BACKGROUNDS_LIMIT) {
+ dispatch(showWarningNotification({
+ descriptionKey: 'virtualBackground.oldestBackgroundRemoved',
+ titleKey: 'virtualBackground.backgroundLimitReached'
+ }, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));
setStoredImages(storedImages.slice(1));
}
- }, [ storedImages ]);
+ }, [ storedImages, dispatch ]);
const enableBlur = useCallback(async () => {
onOptionsChange({