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.

loadEffects.web.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536
  1. // @flow
  2. import { createScreenshotCaptureEffect } from '../../stream-effects/screenshot-capture';
  3. import { createVirtualBackgroundEffect } from '../../stream-effects/virtual-background';
  4. import logger from './logger';
  5. /**
  6. * Loads the enabled stream effects.
  7. *
  8. * @param {Object} store - The Redux store.
  9. * @returns {Promsie} - A Promise which resolves when all effects are created.
  10. */
  11. export default function loadEffects(store: Object): Promise<any> {
  12. const state = store.getState();
  13. const virtualBackground = state['features/virtual-background'];
  14. const backgroundPromise = virtualBackground.backgroundEffectEnabled
  15. ? createVirtualBackgroundEffect(virtualBackground)
  16. .catch(error => {
  17. logger.error('Failed to obtain the background effect instance with error: ', error);
  18. return Promise.resolve();
  19. })
  20. : Promise.resolve();
  21. const screenshotCapturePromise = state['features/screenshot-capture']?.capturesEnabled
  22. ? createScreenshotCaptureEffect(state)
  23. .catch(error => {
  24. logger.error('Failed to obtain the screenshot capture effect effect instance with error: ', error);
  25. return Promise.resolve();
  26. })
  27. : Promise.resolve();
  28. return Promise.all([ backgroundPromise, screenshotCapturePromise ]);
  29. }