Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

subscriber.native.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // @flow
  2. import { getParticipantCountWithFake } from '../base/participants';
  3. import { StateListenerRegistry } from '../base/redux';
  4. import { getTileViewGridDimensions, shouldDisplayTileView } from '../video-layout';
  5. import { setTileViewDimensions } from './actions';
  6. import './subscriber.any';
  7. /**
  8. * Listens for changes in the number of participants to calculate the dimensions of the tile view grid and the tiles.
  9. */
  10. StateListenerRegistry.register(
  11. /* selector */ state => {
  12. const participantCount = getParticipantCountWithFake(state);
  13. if (participantCount < 5) { // the dimensions are updated only when the participant count is lower than 5.
  14. return participantCount;
  15. }
  16. return 4; // make sure we don't update the dimensions.
  17. },
  18. /* listener */ (_, store) => {
  19. const state = store.getState();
  20. if (shouldDisplayTileView(state)) {
  21. store.dispatch(setTileViewDimensions());
  22. }
  23. });
  24. /**
  25. * Listens for changes in the selected layout to calculate the dimensions of the tile view grid and horizontal view.
  26. */
  27. StateListenerRegistry.register(
  28. /* selector */ state => shouldDisplayTileView(state),
  29. /* listener */ (isTileView, store) => {
  30. const state = store.getState();
  31. if (isTileView) {
  32. store.dispatch(setTileViewDimensions(getTileViewGridDimensions(state)));
  33. }
  34. });