Browse Source

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

master
tudordan7 4 years ago
parent
commit
c0917f87ae

+ 2
- 1
lang/main.json View File

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

+ 7
- 1
react/features/virtual-background/components/VirtualBackgroundDialog.js View File

12
 import { VIDEO_TYPE } from '../../base/media';
12
 import { VIDEO_TYPE } from '../../base/media';
13
 import { connect } from '../../base/redux';
13
 import { connect } from '../../base/redux';
14
 import { getLocalVideoTrack } from '../../base/tracks';
14
 import { getLocalVideoTrack } from '../../base/tracks';
15
+import { showErrorNotification } from '../../notifications';
15
 import { toggleBackgroundEffect } from '../actions';
16
 import { toggleBackgroundEffect } from '../actions';
16
 import { VIRTUAL_BACKGROUND_TYPE } from '../constants';
17
 import { VIRTUAL_BACKGROUND_TYPE } from '../constants';
17
 import { resizeImage, toDataURL } from '../functions';
18
 import { resizeImage, toDataURL } from '../functions';
132
         const url = await createLocalTrack('desktop', '');
133
         const url = await createLocalTrack('desktop', '');
133
 
134
 
134
         if (!url) {
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
         setOptions({
143
         setOptions({
138
             backgroundType: VIRTUAL_BACKGROUND_TYPE.DESKTOP_SHARE,
144
             backgroundType: VIRTUAL_BACKGROUND_TYPE.DESKTOP_SHARE,

+ 2
- 2
react/features/virtual-background/middleware.js View File

19
     const virtualSource = getState()['features/virtual-background'].virtualSource;
19
     const virtualSource = getState()['features/virtual-background'].virtualSource;
20
     const currentLocalTrack = getLocalVideoTrack(getState()['features/base/tracks']);
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
     return next(action);
26
     return next(action);

Loading…
Cancel
Save