Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // @flow
  2. import VideoLayout from '../../../modules/UI/videolayout/VideoLayout.js';
  3. import UIEvents from '../../../service/UI/UIEvents';
  4. import { CONFERENCE_JOINED } from '../base/conference';
  5. import {
  6. DOMINANT_SPEAKER_CHANGED,
  7. PARTICIPANT_JOINED,
  8. PARTICIPANT_LEFT,
  9. PARTICIPANT_UPDATED,
  10. PIN_PARTICIPANT,
  11. getParticipantById
  12. } from '../base/participants';
  13. import { MiddlewareRegistry } from '../base/redux';
  14. import { TRACK_ADDED } from '../base/tracks';
  15. import { SET_TILE_VIEW } from './actionTypes';
  16. declare var APP: Object;
  17. /**
  18. * Middleware which intercepts actions and updates the legacy component
  19. * {@code VideoLayout} as needed. The purpose of this middleware is to redux-ify
  20. * {@code VideoLayout} without having to simultaneously react-ifying it.
  21. *
  22. * @param {Store} store - The redux store.
  23. * @returns {Function}
  24. */
  25. // eslint-disable-next-line no-unused-vars
  26. MiddlewareRegistry.register(store => next => action => {
  27. // Purposefully perform additional actions after state update to mimic
  28. // being connected to the store for updates.
  29. const result = next(action);
  30. switch (action.type) {
  31. case CONFERENCE_JOINED:
  32. VideoLayout.mucJoined();
  33. break;
  34. case PARTICIPANT_JOINED:
  35. if (!action.participant.local) {
  36. VideoLayout.addRemoteParticipantContainer(
  37. getParticipantById(store.getState(), action.participant.id));
  38. }
  39. break;
  40. case PARTICIPANT_LEFT:
  41. VideoLayout.removeParticipantContainer(action.participant.id);
  42. break;
  43. case PARTICIPANT_UPDATED: {
  44. // Look for actions that triggered a change to connectionStatus. This is
  45. // done instead of changing the connection status change action to be
  46. // explicit in order to minimize changes to other code.
  47. if (typeof action.participant.connectionStatus !== 'undefined') {
  48. VideoLayout.onParticipantConnectionStatusChanged(
  49. action.participant.id,
  50. action.participant.connectionStatus);
  51. }
  52. break;
  53. }
  54. case DOMINANT_SPEAKER_CHANGED:
  55. VideoLayout.onDominantSpeakerChanged(action.participant.id);
  56. break;
  57. case PIN_PARTICIPANT:
  58. VideoLayout.onPinChange(action.participant.id);
  59. APP.UI.emitEvent(
  60. UIEvents.PINNED_ENDPOINT,
  61. action.participant.id,
  62. Boolean(action.participant.id));
  63. break;
  64. case SET_TILE_VIEW:
  65. APP.UI.emitEvent(UIEvents.TOGGLED_TILE_VIEW, action.enabled);
  66. break;
  67. case TRACK_ADDED:
  68. if (!action.track.local) {
  69. VideoLayout.onRemoteStreamAdded(action.track.jitsiTrack);
  70. }
  71. break;
  72. }
  73. return result;
  74. });