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(virtual-background): Desktop share as virtual background

tudordan7c0917f87ae23
diff --git a/lang/main.json b/lang/main.json
index 40f8ed61e1..2d583bd7cb 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -341,7 +341,8 @@
"slightBlur": "Slight Blur",
"removeBackground": "Remove background",
"addBackground": "Add background",
- "none": "None"
+ "none": "None",
+ "desktopShareError": "Could not create desktop share"
},
"feedback": {
"average": "Average",
diff --git a/react/features/virtual-background/components/VirtualBackgroundDialog.js b/react/features/virtual-background/components/VirtualBackgroundDialog.js
index 3b51311506..bd4328fe22 100644
--- a/react/features/virtual-background/components/VirtualBackgroundDialog.js
+++ b/react/features/virtual-background/components/VirtualBackgroundDialog.js
@@ -12,6 +12,7 @@ import { createLocalTrack } from '../../base/lib-jitsi-meet/functions';
import { VIDEO_TYPE } from '../../base/media';
import { connect } from '../../base/redux';
import { getLocalVideoTrack } from '../../base/tracks';
+import { showErrorNotification } from '../../notifications';
import { toggleBackgroundEffect } from '../actions';
import { VIRTUAL_BACKGROUND_TYPE } from '../constants';
import { resizeImage, toDataURL } from '../functions';
@@ -132,7 +133,12 @@ function VirtualBackground({ _jitsiTrack, _selectedThumbnail, _virtualSource, di
const url = await createLocalTrack('desktop', '');
if (!url) {
- throw new Error('Could not create desktop local track!');
+ dispatch(showErrorNotification({
+ titleKey: 'virtualBackground.desktopShareError'
+ }));
+ logger.error('Could not create desktop share as a virtual background!');
+
+ return;
}
setOptions({
backgroundType: VIRTUAL_BACKGROUND_TYPE.DESKTOP_SHARE,
diff --git a/react/features/virtual-background/middleware.js b/react/features/virtual-background/middleware.js
index ce9bc910af..100156d2fa 100644
--- a/react/features/virtual-background/middleware.js
+++ b/react/features/virtual-background/middleware.js
@@ -19,8 +19,8 @@ MiddlewareRegistry.register(store => next => action => {
const virtualSource = getState()['features/virtual-background'].virtualSource;
const currentLocalTrack = getLocalVideoTrack(getState()['features/base/tracks']);
- if (virtualSource?.videoType === VIDEO_TYPE.DESKTOP && currentLocalTrack) {
- localTrackStopped(dispatch, virtualSource, currentLocalTrack.jitsiTrack);
+ if (virtualSource?.videoType === VIDEO_TYPE.DESKTOP) {
+ localTrackStopped(dispatch, virtualSource, currentLocalTrack?.jitsiTrack);
}
return next(action);