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.ts 915B

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