Skip to content

Commit

Permalink
Fix disable virtual background feature, now hides the feature everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
javierckr authored and damencho committed Sep 20, 2023
1 parent 8a7f456 commit 2952d1c
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Checkbox from '../../../../base/ui/components/web/Checkbox';
import ContextMenu from '../../../../base/ui/components/web/ContextMenu';
import ContextMenuItem from '../../../../base/ui/components/web/ContextMenuItem';
import ContextMenuItemGroup from '../../../../base/ui/components/web/ContextMenuItemGroup';
import { checkBlurSupport } from '../../../../virtual-background/functions';
import { checkBlurSupport, checkVirtualBackgroundEnabled } from '../../../../virtual-background/functions';
import { openSettingsDialog } from '../../../actions';
import { SETTINGS_TABS } from '../../../constants';
import { createLocalVideoTracks } from '../../../functions.web';
Expand Down Expand Up @@ -57,6 +57,11 @@ export interface IProps {
* All the camera device ids currently connected.
*/
videoDeviceIds: string[];

/**
* Whether or not the virtual background is visible.
*/
visibleVirtualBackground: boolean;
}

const useStyles = makeStyles()(theme => {
Expand Down Expand Up @@ -145,7 +150,8 @@ const VideoSettingsContent = ({
selectBackground,
setVideoInputDevice,
toggleVideoSettings,
videoDeviceIds
videoDeviceIds,
visibleVirtualBackground
}: IProps) => {
const _componentWasUnmounted = useRef(false);
const [ trackData, setTrackData ] = useState(new Array(videoDeviceIds.length).fill({
Expand Down Expand Up @@ -287,8 +293,6 @@ const VideoSettingsContent = ({
}
}, [ videoDeviceIds ]);

const virtualBackgroundSupported = checkBlurSupport();

return (
<ContextMenu
aria-labelledby = 'video-settings-button'
Expand All @@ -301,7 +305,7 @@ const VideoSettingsContent = ({
{trackData.map((data, i) => _renderPreviewEntry(data, i))}
</ContextMenuItemGroup>
<ContextMenuItemGroup>
{ virtualBackgroundSupported && <ContextMenuItem
{ visibleVirtualBackground && <ContextMenuItem
accessibilityLabel = { t('virtualBackground.title') }
icon = { IconImage }
onClick = { selectBackground }
Expand All @@ -323,7 +327,9 @@ const mapStateToProps = (state: IReduxState) => {
const { localFlipX } = state['features/base/settings'];

return {
localFlipX: Boolean(localFlipX)
localFlipX: Boolean(localFlipX),
visibleVirtualBackground: checkBlurSupport()
&& checkVirtualBackgroundEnabled(state)
};
};

Expand Down

0 comments on commit 2952d1c

Please sign in to comment.