Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

subscriber.ts 1.7KB

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