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.

middleware.js 912B

123456789101112131415161718192021222324252627
  1. // @flow
  2. import { VIDEO_TYPE } from '../base/media';
  3. import { MiddlewareRegistry } from '../base/redux';
  4. import { getLocalVideoTrack } from '../base/tracks';
  5. import { localTrackStopped } from './functions';
  6. /**
  7. * Middleware which intercepts the desktop video type on
  8. * virtual background. If the user stops the screen share
  9. * then the default virtual background is set to 'none' option
  10. *
  11. * @param {Store} store - The redux store.
  12. * @returns {Function}
  13. */
  14. MiddlewareRegistry.register(store => next => action => {
  15. const { dispatch, getState } = store;
  16. const virtualSource = getState()['features/virtual-background'].virtualSource;
  17. const currentLocalTrack = getLocalVideoTrack(getState()['features/base/tracks']);
  18. if (virtualSource?.videoType === VIDEO_TYPE.DESKTOP) {
  19. localTrackStopped(dispatch, virtualSource, currentLocalTrack?.jitsiTrack);
  20. }
  21. return next(action);
  22. });