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

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