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.

subscriber.any.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // @flow
  2. import { StateListenerRegistry } from '../base/redux';
  3. import { updateRemoteParticipants } from './functions';
  4. /**
  5. * Listens for changes to the screensharing status of the remote participants to recompute the reordered list of the
  6. * remote endpoints.
  7. */
  8. StateListenerRegistry.register(
  9. /* selector */ state => state['features/video-layout'].remoteScreenShares,
  10. /* listener */ (remoteScreenShares, store) => updateRemoteParticipants(store));
  11. /**
  12. * Listens for changes to the dominant speaker to recompute the reordered list of the remote endpoints.
  13. */
  14. StateListenerRegistry.register(
  15. /* selector */ state => state['features/base/participants'].dominantSpeaker,
  16. /* listener */ (dominantSpeaker, store) => _reorderDominantSpeakers(store));
  17. /**
  18. * Private helper function that reorders the remote participants based on dominant speaker changes.
  19. *
  20. * @param {*} store - The redux store.
  21. * @returns {void}
  22. * @private
  23. */
  24. function _reorderDominantSpeakers(store) {
  25. const state = store.getState();
  26. const { dominantSpeaker, local } = state['features/base/participants'];
  27. const { visibleRemoteParticipants } = state['features/filmstrip'];
  28. // Reorder the participants if the new dominant speaker is currently not visible.
  29. if (dominantSpeaker !== local?.id && !visibleRemoteParticipants.has(dominantSpeaker)) {
  30. updateRemoteParticipants(store);
  31. }
  32. }