選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

subscriber.web.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // @flow
  2. import { StateListenerRegistry, equals } from '../base/redux';
  3. import Filmstrip from '../../../modules/UI/videolayout/Filmstrip';
  4. import VideoLayout from '../../../modules/UI/videolayout/VideoLayout';
  5. import { getCurrentLayout, getTileViewGridDimensions, shouldDisplayTileView, LAYOUTS } from '../video-layout';
  6. import { setHorizontalViewDimensions, setTileViewDimensions } from './actions';
  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 => state['features/base/participants'].length,
  12. /* listener */ (numberOfParticipants, store) => {
  13. const state = store.getState();
  14. if (shouldDisplayTileView(state)) {
  15. const gridDimensions = getTileViewGridDimensions(state);
  16. const oldGridDimensions = state['features/filmstrip'].tileViewDimensions.gridDimensions;
  17. const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
  18. if (!equals(gridDimensions, oldGridDimensions)) {
  19. store.dispatch(setTileViewDimensions(gridDimensions, {
  20. clientHeight,
  21. clientWidth
  22. }));
  23. }
  24. }
  25. });
  26. /**
  27. * Listens for changes in the selected layout to calculate the dimensions of the tile view grid and horizontal view.
  28. */
  29. StateListenerRegistry.register(
  30. /* selector */ state => getCurrentLayout(state),
  31. /* listener */ (layout, store) => {
  32. const state = store.getState();
  33. switch (layout) {
  34. case LAYOUTS.TILE_VIEW: {
  35. const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
  36. store.dispatch(setTileViewDimensions(
  37. getTileViewGridDimensions(state), {
  38. clientHeight,
  39. clientWidth
  40. }));
  41. break;
  42. }
  43. case LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW:
  44. store.dispatch(setHorizontalViewDimensions(state['features/base/responsive-ui'].clientHeight));
  45. break;
  46. case LAYOUTS.VERTICAL_FILMSTRIP_VIEW:
  47. // Once the thumbnails are reactified this should be moved there too.
  48. Filmstrip.resizeThumbnailsForVerticalView();
  49. break;
  50. }
  51. });
  52. /**
  53. * Handles on stage participant updates.
  54. */
  55. StateListenerRegistry.register(
  56. /* selector */ state => state['features/large-video'].participantId,
  57. /* listener */ (participantId, store, oldParticipantId) => {
  58. const newThumbnail = VideoLayout.getSmallVideo(participantId);
  59. const oldThumbnail = VideoLayout.getSmallVideo(oldParticipantId);
  60. if (newThumbnail) {
  61. newThumbnail.updateView();
  62. }
  63. if (oldThumbnail) {
  64. oldThumbnail.updateView();
  65. }
  66. }
  67. );