You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hooks.ts 895B

123456789101112131415161718192021222324252627
  1. import { useSelector } from 'react-redux';
  2. import { isScreenVideoShared } from '../screen-share/functions';
  3. import VideoBackgroundButton from './components/VideoBackgroundButton';
  4. import { checkBlurSupport, checkVirtualBackgroundEnabled } from './functions';
  5. const virtualBackground = {
  6. key: 'select-background',
  7. Content: VideoBackgroundButton,
  8. group: 3
  9. };
  10. /**
  11. * A hook that returns the virtual background button if it is enabled and undefined otherwise.
  12. *
  13. * @returns {Object | undefined}
  14. */
  15. export function useVirtualBackgroundButton() {
  16. const _checkBlurSupport = checkBlurSupport();
  17. const _isScreenVideoShared = useSelector(isScreenVideoShared);
  18. const _checkVirtualBackgroundEnabled = useSelector(checkVirtualBackgroundEnabled);
  19. if (_checkBlurSupport && !_isScreenVideoShared && _checkVirtualBackgroundEnabled) {
  20. return virtualBackground;
  21. }
  22. }