|
@@ -83,9 +83,9 @@ type Props = {
|
83
|
83
|
_selectedThumbnail: string,
|
84
|
84
|
|
85
|
85
|
/**
|
86
|
|
- * Returns the selected virtual source object.
|
|
86
|
+ * Returns the selected virtual background object.
|
87
|
87
|
*/
|
88
|
|
- _virtualSource: Object,
|
|
88
|
+ _virtualBackground: Object,
|
89
|
89
|
|
90
|
90
|
/**
|
91
|
91
|
* The redux {@code dispatch} function.
|
|
@@ -107,14 +107,16 @@ const onError = event => {
|
107
|
107
|
*
|
108
|
108
|
* @returns {ReactElement}
|
109
|
109
|
*/
|
110
|
|
-function VirtualBackground({ _jitsiTrack, _selectedThumbnail, _virtualSource, dispatch, t }: Props) {
|
|
110
|
+function VirtualBackground({ _jitsiTrack, _selectedThumbnail, _virtualBackground, dispatch, t }: Props) {
|
111
|
111
|
const [ options, setOptions ] = useState({});
|
112
|
112
|
const localImages = jitsiLocalStorage.getItem('virtualBackgrounds');
|
113
|
113
|
const [ storedImages, setStoredImages ] = useState<Array<Image>>((localImages && Bourne.parse(localImages)) || []);
|
114
|
114
|
const [ loading, setLoading ] = useState(false);
|
115
|
115
|
const uploadImageButton: Object = useRef(null);
|
116
|
|
- const [ activeDesktopVideo ] = useState(_virtualSource?.videoType === VIDEO_TYPE.DESKTOP ? _virtualSource : null);
|
117
|
|
-
|
|
116
|
+ const [ activeDesktopVideo ] = useState(_virtualBackground?.virtualSource?.videoType === VIDEO_TYPE.DESKTOP
|
|
117
|
+ ? _virtualBackground.virtualSource
|
|
118
|
+ : null);
|
|
119
|
+ const [ initialVirtualBackground ] = useState(_virtualBackground);
|
118
|
120
|
const deleteStoredImage = useCallback(e => {
|
119
|
121
|
const imageId = e.currentTarget.getAttribute('data-imageid');
|
120
|
122
|
|
|
@@ -308,10 +310,23 @@ function VirtualBackground({ _jitsiTrack, _selectedThumbnail, _virtualSource, di
|
308
|
310
|
dispatch(hideDialog());
|
309
|
311
|
}, [ dispatch, options ]);
|
310
|
312
|
|
|
313
|
+ // Prevent the selection of a new virtual background if it has not been applied by default
|
|
314
|
+ const cancelVirtualBackground = useCallback(async () => {
|
|
315
|
+ await setOptions({
|
|
316
|
+ backgroundType: initialVirtualBackground.backgroundType,
|
|
317
|
+ enabled: initialVirtualBackground.backgroundEffectEnabled,
|
|
318
|
+ url: initialVirtualBackground.virtualSource,
|
|
319
|
+ selectedThumbnail: initialVirtualBackground.selectedThumbnail,
|
|
320
|
+ blurValue: initialVirtualBackground.blurValue
|
|
321
|
+ });
|
|
322
|
+ dispatch(hideDialog());
|
|
323
|
+ });
|
|
324
|
+
|
311
|
325
|
return (
|
312
|
326
|
<Dialog
|
313
|
327
|
hideCancelButton = { false }
|
314
|
328
|
okKey = { 'virtualBackground.apply' }
|
|
329
|
+ onCancel = { cancelVirtualBackground }
|
315
|
330
|
onSubmit = { applyVirtualBackground }
|
316
|
331
|
submitDisabled = { !options || loading }
|
317
|
332
|
titleKey = { 'virtualBackground.title' } >
|
|
@@ -478,7 +493,7 @@ function VirtualBackground({ _jitsiTrack, _selectedThumbnail, _virtualSource, di
|
478
|
493
|
*/
|
479
|
494
|
function _mapStateToProps(state): Object {
|
480
|
495
|
return {
|
481
|
|
- _virtualSource: state['features/virtual-background'].virtualSource,
|
|
496
|
+ _virtualBackground: state['features/virtual-background'],
|
482
|
497
|
_selectedThumbnail: state['features/virtual-background'].selectedThumbnail,
|
483
|
498
|
_jitsiTrack: getLocalVideoTrack(state['features/base/tracks'])?.jitsiTrack
|
484
|
499
|
};
|