|
@@ -63,6 +63,11 @@ type Props = {
|
63
|
63
|
*/
|
64
|
64
|
_selectedThumbnail: string,
|
65
|
65
|
|
|
66
|
+ /**
|
|
67
|
+ * Returns the selected virtual source object.
|
|
68
|
+ */
|
|
69
|
+ _virtualSource: Object,
|
|
70
|
+
|
66
|
71
|
/**
|
67
|
72
|
* The redux {@code dispatch} function.
|
68
|
73
|
*/
|
|
@@ -79,11 +84,12 @@ type Props = {
|
79
|
84
|
*
|
80
|
85
|
* @returns {ReactElement}
|
81
|
86
|
*/
|
82
|
|
-function VirtualBackground({ _jitsiTrack, _selectedThumbnail, dispatch, t }: Props) {
|
|
87
|
+function VirtualBackground({ _jitsiTrack, _selectedThumbnail, _virtualSource, dispatch, t }: Props) {
|
83
|
88
|
const [ options, setOptions ] = useState({});
|
84
|
89
|
const localImages = jitsiLocalStorage.getItem('virtualBackgrounds');
|
85
|
90
|
const [ storedImages, setStoredImages ] = useState((localImages && JSON.parse(localImages)) || []);
|
86
|
91
|
const [ loading, isloading ] = useState(false);
|
|
92
|
+ const [ activeDesktopVideo ] = useState(_virtualSource?.videoType === 'desktop' ? _virtualSource : null);
|
87
|
93
|
|
88
|
94
|
const deleteStoredImage = image => {
|
89
|
95
|
setStoredImages(storedImages.filter(item => item !== image));
|
|
@@ -180,6 +186,9 @@ function VirtualBackground({ _jitsiTrack, _selectedThumbnail, dispatch, t }: Pro
|
180
|
186
|
};
|
181
|
187
|
|
182
|
188
|
const applyVirtualBackground = async () => {
|
|
189
|
+ if (activeDesktopVideo) {
|
|
190
|
+ await activeDesktopVideo.dispose();
|
|
191
|
+ }
|
183
|
192
|
isloading(true);
|
184
|
193
|
await dispatch(toggleBackgroundEffect(options, _jitsiTrack));
|
185
|
194
|
await isloading(false);
|
|
@@ -289,6 +298,7 @@ function VirtualBackground({ _jitsiTrack, _selectedThumbnail, dispatch, t }: Pro
|
289
|
298
|
*/
|
290
|
299
|
function _mapStateToProps(state): Object {
|
291
|
300
|
return {
|
|
301
|
+ _virtualSource: state['features/virtual-background'].virtualSource,
|
292
|
302
|
_selectedThumbnail: state['features/virtual-background'].selectedThumbnail,
|
293
|
303
|
_jitsiTrack: getLocalVideoTrack(state['features/base/tracks'])?.jitsiTrack
|
294
|
304
|
};
|