feat(virtual-background): Desktop share as virtual background
This commit is contained in:
parent
06c527b6fe
commit
c0917f87ae
|
@ -341,7 +341,8 @@
|
||||||
"slightBlur": "Slight Blur",
|
"slightBlur": "Slight Blur",
|
||||||
"removeBackground": "Remove background",
|
"removeBackground": "Remove background",
|
||||||
"addBackground": "Add background",
|
"addBackground": "Add background",
|
||||||
"none": "None"
|
"none": "None",
|
||||||
|
"desktopShareError": "Could not create desktop share"
|
||||||
},
|
},
|
||||||
"feedback": {
|
"feedback": {
|
||||||
"average": "Average",
|
"average": "Average",
|
||||||
|
|
|
@ -12,6 +12,7 @@ import { createLocalTrack } from '../../base/lib-jitsi-meet/functions';
|
||||||
import { VIDEO_TYPE } from '../../base/media';
|
import { VIDEO_TYPE } from '../../base/media';
|
||||||
import { connect } from '../../base/redux';
|
import { connect } from '../../base/redux';
|
||||||
import { getLocalVideoTrack } from '../../base/tracks';
|
import { getLocalVideoTrack } from '../../base/tracks';
|
||||||
|
import { showErrorNotification } from '../../notifications';
|
||||||
import { toggleBackgroundEffect } from '../actions';
|
import { toggleBackgroundEffect } from '../actions';
|
||||||
import { VIRTUAL_BACKGROUND_TYPE } from '../constants';
|
import { VIRTUAL_BACKGROUND_TYPE } from '../constants';
|
||||||
import { resizeImage, toDataURL } from '../functions';
|
import { resizeImage, toDataURL } from '../functions';
|
||||||
|
@ -132,7 +133,12 @@ function VirtualBackground({ _jitsiTrack, _selectedThumbnail, _virtualSource, di
|
||||||
const url = await createLocalTrack('desktop', '');
|
const url = await createLocalTrack('desktop', '');
|
||||||
|
|
||||||
if (!url) {
|
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({
|
setOptions({
|
||||||
backgroundType: VIRTUAL_BACKGROUND_TYPE.DESKTOP_SHARE,
|
backgroundType: VIRTUAL_BACKGROUND_TYPE.DESKTOP_SHARE,
|
||||||
|
|
|
@ -19,8 +19,8 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
const virtualSource = getState()['features/virtual-background'].virtualSource;
|
const virtualSource = getState()['features/virtual-background'].virtualSource;
|
||||||
const currentLocalTrack = getLocalVideoTrack(getState()['features/base/tracks']);
|
const currentLocalTrack = getLocalVideoTrack(getState()['features/base/tracks']);
|
||||||
|
|
||||||
if (virtualSource?.videoType === VIDEO_TYPE.DESKTOP && currentLocalTrack) {
|
if (virtualSource?.videoType === VIDEO_TYPE.DESKTOP) {
|
||||||
localTrackStopped(dispatch, virtualSource, currentLocalTrack.jitsiTrack);
|
localTrackStopped(dispatch, virtualSource, currentLocalTrack?.jitsiTrack);
|
||||||
}
|
}
|
||||||
|
|
||||||
return next(action);
|
return next(action);
|
||||||
|
|
Loading…
Reference in New Issue