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.web.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // @flow
  2. import VideoLayout from '../../../modules/UI/videolayout/VideoLayout.js';
  3. import UIEvents from '../../../service/UI/UIEvents';
  4. import {
  5. DOMINANT_SPEAKER_CHANGED,
  6. PIN_PARTICIPANT
  7. } from '../base/participants';
  8. import { MiddlewareRegistry } from '../base/redux';
  9. declare var APP: Object;
  10. /**
  11. * Middleware which intercepts actions and updates the legacy component
  12. * {@code VideoLayout} as needed. The purpose of this middleware is to redux-ify
  13. * {@code VideoLayout} without having to simultaneously react-ifying it.
  14. *
  15. * @param {Store} store - The redux store.
  16. * @returns {Function}
  17. */
  18. // eslint-disable-next-line no-unused-vars
  19. MiddlewareRegistry.register(store => next => action => {
  20. // Purposefully perform additional actions after state update to mimic
  21. // being connected to the store for updates.
  22. const result = next(action);
  23. switch (action.type) {
  24. case DOMINANT_SPEAKER_CHANGED:
  25. VideoLayout.onDominantSpeakerChanged(action.participant.id);
  26. break;
  27. case PIN_PARTICIPANT:
  28. VideoLayout.onPinChange(action.participant.id);
  29. APP.UI.emitEvent(
  30. UIEvents.PINNED_ENDPOINT,
  31. action.participant.id,
  32. Boolean(action.participant.id));
  33. break;
  34. }
  35. return result;
  36. });