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.web.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // @flow
  2. import VideoLayout from '../../../modules/UI/videolayout/VideoLayout';
  3. import { getMultipleVideoSupportFeatureFlag } from '../base/config';
  4. import { MEDIA_TYPE } from '../base/media';
  5. import { isScreenShareParticipant } from '../base/participants';
  6. import { StateListenerRegistry } from '../base/redux';
  7. import { getTrackByMediaTypeAndParticipant, getVirtualScreenshareParticipantTrack } from '../base/tracks';
  8. import { getLargeVideoParticipant } from './functions';
  9. /**
  10. * Updates the on stage participant video.
  11. */
  12. StateListenerRegistry.register(
  13. /* selector */ state => state['features/large-video'].participantId,
  14. /* listener */ participantId => {
  15. VideoLayout.updateLargeVideo(participantId, true);
  16. }
  17. );
  18. /**
  19. * Schedules a large video update when the streaming status of the track associated with the large video changes.
  20. */
  21. StateListenerRegistry.register(
  22. /* selector */ state => {
  23. const largeVideoParticipant = getLargeVideoParticipant(state);
  24. const tracks = state['features/base/tracks'];
  25. let videoTrack;
  26. if (getMultipleVideoSupportFeatureFlag(state) && isScreenShareParticipant(largeVideoParticipant)) {
  27. videoTrack = getVirtualScreenshareParticipantTrack(tracks, largeVideoParticipant?.id);
  28. } else {
  29. videoTrack = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, largeVideoParticipant?.id);
  30. }
  31. return {
  32. participantId: largeVideoParticipant?.id,
  33. streamingStatus: videoTrack?.streamingStatus
  34. };
  35. },
  36. /* listener */ ({ participantId, streamingStatus }, previousState = {}) => {
  37. if (streamingStatus !== previousState.streamingStatus) {
  38. VideoLayout.updateLargeVideo(participantId, true);
  39. }
  40. }, {
  41. deepEquals: true
  42. }
  43. );