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 893B

123456789101112131415161718192021222324252627282930313233
  1. // @flow
  2. import { StateListenerRegistry } from '../base/redux';
  3. import { resume, pause } from './actions';
  4. /**
  5. * Listens for large video participant ID changes.
  6. */
  7. StateListenerRegistry.register(
  8. /* selector */ state => {
  9. const { participantId } = state['features/large-video'];
  10. const { controller } = state['features/remote-control'];
  11. const { controlled } = controller;
  12. if (!controlled) {
  13. return undefined;
  14. }
  15. return controlled === participantId;
  16. },
  17. /* listener */ (isControlledParticipantOnStage, { dispatch }) => {
  18. if (isControlledParticipantOnStage === true) {
  19. dispatch(resume());
  20. } else if (isControlledParticipantOnStage === false) {
  21. dispatch(pause());
  22. }
  23. // else {
  24. // isControlledParticipantOnStage === undefined. Ignore!
  25. // }
  26. }
  27. );