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.ts 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import _ from 'lodash';
  2. import StateListenerRegistry from '../redux/StateListenerRegistry';
  3. import { isLocalCameraTrackMuted } from './functions';
  4. /**
  5. * Notifies when the list of currently sharing participants changes.
  6. */
  7. StateListenerRegistry.register(
  8. /* selector */ state =>
  9. state['features/base/tracks'].filter(tr => tr.videoType === 'desktop').map(t => t.participantId),
  10. /* listener */ (participantIDs, store, previousParticipantIDs) => {
  11. if (typeof APP !== 'object') {
  12. return;
  13. }
  14. if (!_.isEqual(_.sortBy(participantIDs), _.sortBy(previousParticipantIDs))) {
  15. APP.API.notifySharingParticipantsChanged(participantIDs);
  16. }
  17. }
  18. );
  19. /**
  20. * Notifies when the local video mute state changes.
  21. */
  22. StateListenerRegistry.register(
  23. /* selector */ state => isLocalCameraTrackMuted(state['features/base/tracks']),
  24. /* listener */ (muted, store, previousMuted) => {
  25. if (typeof APP !== 'object') {
  26. return;
  27. }
  28. if (muted !== previousMuted) {
  29. APP.API.notifyVideoMutedStatusChanged(muted);
  30. }
  31. }
  32. );