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

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