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.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // @flow
  2. import { appNavigate } from '../app';
  3. import {
  4. CONFERENCE_JOINED,
  5. KICKED_OUT,
  6. VIDEO_QUALITY_LEVELS,
  7. conferenceFailed,
  8. setReceiveVideoQuality
  9. } from '../base/conference';
  10. import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
  11. import { SET_REDUCED_UI } from '../base/responsive-ui';
  12. import { MiddlewareRegistry } from '../base/redux';
  13. import { setFilmstripEnabled } from '../filmstrip';
  14. import { setToolboxEnabled } from '../toolbox';
  15. MiddlewareRegistry.register(store => next => action => {
  16. const result = next(action);
  17. switch (action.type) {
  18. case CONFERENCE_JOINED:
  19. case SET_REDUCED_UI: {
  20. const { dispatch, getState } = store;
  21. const state = getState();
  22. const { audioOnly } = state['features/base/conference'];
  23. const { reducedUI } = state['features/base/responsive-ui'];
  24. dispatch(setToolboxEnabled(!reducedUI));
  25. dispatch(setFilmstripEnabled(!reducedUI));
  26. // XXX: Currently setting the received video quality will disable
  27. // audio-only mode if engaged, that's why we check for it here.
  28. audioOnly
  29. || dispatch(
  30. setReceiveVideoQuality(
  31. reducedUI
  32. ? VIDEO_QUALITY_LEVELS.LOW
  33. : VIDEO_QUALITY_LEVELS.HIGH));
  34. break;
  35. }
  36. case KICKED_OUT: {
  37. const { dispatch } = store;
  38. dispatch(
  39. conferenceFailed(action.conference, JitsiConferenceEvents.KICKED));
  40. dispatch(appNavigate(undefined));
  41. break;
  42. }
  43. }
  44. return result;
  45. });