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.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // @flow
  2. import {
  3. getParticipantById,
  4. getVirtualScreenshareParticipantByOwnerId,
  5. getVirtualScreenshareParticipantOwnerId,
  6. isScreenShareParticipant
  7. } from '../base/participants';
  8. import { StateListenerRegistry } from '../base/redux';
  9. import { pause, resume } from './actions';
  10. /**
  11. * Listens for large video participant ID changes.
  12. */
  13. StateListenerRegistry.register(
  14. /* selector */ state => {
  15. const { participantId } = state['features/large-video'];
  16. const { controller } = state['features/remote-control'];
  17. const { controlled } = controller;
  18. if (!controlled) {
  19. return undefined;
  20. }
  21. const participant = getParticipantById(state, participantId);
  22. if (isScreenShareParticipant(participant)) {
  23. // multistream support is enabled and the user has selected the desktop sharing thumbnail.
  24. const id = getVirtualScreenshareParticipantOwnerId(participantId);
  25. return id === controlled;
  26. }
  27. const virtualParticipant = getVirtualScreenshareParticipantByOwnerId(state, participantId);
  28. if (virtualParticipant) { // multistream is enabled and the user has selected the camera thumbnail.
  29. return false;
  30. }
  31. return controlled === participantId;
  32. },
  33. /* listener */ (isControlledParticipantOnStage, { dispatch }) => {
  34. if (isControlledParticipantOnStage === true) {
  35. dispatch(resume());
  36. } else if (isControlledParticipantOnStage === false) {
  37. dispatch(pause());
  38. }
  39. // else {
  40. // isControlledParticipantOnStage === undefined. Ignore!
  41. // }
  42. }
  43. );