您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

middleware.js 858B

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