Parcourir la source

feat(virtual-background): Desktop share as virtual background

master
tudordan7 il y a 3 ans
Parent
révision
c0917f87ae

+ 2
- 1
lang/main.json Voir le fichier

@@ -341,7 +341,8 @@
341 341
         "slightBlur": "Slight Blur",
342 342
         "removeBackground": "Remove background",
343 343
         "addBackground": "Add background",
344
-        "none": "None"
344
+        "none": "None",
345
+        "desktopShareError": "Could not create desktop share"
345 346
     },
346 347
     "feedback": {
347 348
         "average": "Average",

+ 7
- 1
react/features/virtual-background/components/VirtualBackgroundDialog.js Voir le fichier

@@ -12,6 +12,7 @@ import { createLocalTrack } from '../../base/lib-jitsi-meet/functions';
12 12
 import { VIDEO_TYPE } from '../../base/media';
13 13
 import { connect } from '../../base/redux';
14 14
 import { getLocalVideoTrack } from '../../base/tracks';
15
+import { showErrorNotification } from '../../notifications';
15 16
 import { toggleBackgroundEffect } from '../actions';
16 17
 import { VIRTUAL_BACKGROUND_TYPE } from '../constants';
17 18
 import { resizeImage, toDataURL } from '../functions';
@@ -132,7 +133,12 @@ function VirtualBackground({ _jitsiTrack, _selectedThumbnail, _virtualSource, di
132 133
         const url = await createLocalTrack('desktop', '');
133 134
 
134 135
         if (!url) {
135
-            throw new Error('Could not create desktop local track!');
136
+            dispatch(showErrorNotification({
137
+                titleKey: 'virtualBackground.desktopShareError'
138
+            }));
139
+            logger.error('Could not create desktop share as a virtual background!');
140
+
141
+            return;
136 142
         }
137 143
         setOptions({
138 144
             backgroundType: VIRTUAL_BACKGROUND_TYPE.DESKTOP_SHARE,

+ 2
- 2
react/features/virtual-background/middleware.js Voir le fichier

@@ -19,8 +19,8 @@ MiddlewareRegistry.register(store => next => action => {
19 19
     const virtualSource = getState()['features/virtual-background'].virtualSource;
20 20
     const currentLocalTrack = getLocalVideoTrack(getState()['features/base/tracks']);
21 21
 
22
-    if (virtualSource?.videoType === VIDEO_TYPE.DESKTOP && currentLocalTrack) {
23
-        localTrackStopped(dispatch, virtualSource, currentLocalTrack.jitsiTrack);
22
+    if (virtualSource?.videoType === VIDEO_TYPE.DESKTOP) {
23
+        localTrackStopped(dispatch, virtualSource, currentLocalTrack?.jitsiTrack);
24 24
     }
25 25
 
26 26
     return next(action);

Chargement…
Annuler
Enregistrer