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 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // @flow
  2. import { MiddlewareRegistry } from '../base/redux';
  3. import { updateSettings } from '../base/settings';
  4. import { getLocalVideoTrack, replaceLocalTrack } from '../base/tracks';
  5. import { PREJOIN_START_CONFERENCE } from './actionTypes';
  6. import { setPrejoinPageVisibility } from './actions';
  7. declare var APP: Object;
  8. /**
  9. * The redux middleware for {@link PrejoinPage}.
  10. *
  11. * @param {Store} store - The redux store.
  12. * @returns {Function}
  13. */
  14. MiddlewareRegistry.register(store => next => async action => {
  15. switch (action.type) {
  16. case PREJOIN_START_CONFERENCE: {
  17. const { getState, dispatch } = store;
  18. const state = getState();
  19. const { userSelectedSkipPrejoin } = state['features/prejoin'];
  20. const localVideoTrack = getLocalVideoTrack(state['features/base/tracks']);
  21. userSelectedSkipPrejoin && dispatch(updateSettings({
  22. userSelectedSkipPrejoin
  23. }));
  24. if (localVideoTrack?.muted) {
  25. await dispatch(replaceLocalTrack(localVideoTrack.jitsiTrack, null));
  26. }
  27. const jitsiTracks = getState()['features/base/tracks'].map(t => t.jitsiTrack);
  28. dispatch(setPrejoinPageVisibility(false));
  29. APP.conference.prejoinStart(jitsiTracks);
  30. break;
  31. }
  32. }
  33. return next(action);
  34. });