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.ts 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // @ts-expect-error
  2. import VideoLayout from '../../../modules/UI/videolayout/VideoLayout';
  3. import StateListenerRegistry from '../base/redux/StateListenerRegistry';
  4. import { getVideoTrackByParticipant } from '../base/tracks/functions.web';
  5. import { getLargeVideoParticipant } from './functions';
  6. /**
  7. * Updates the on stage participant video.
  8. */
  9. StateListenerRegistry.register(
  10. /* selector */ state => state['features/large-video'].participantId,
  11. /* listener */ participantId => {
  12. VideoLayout.updateLargeVideo(participantId, true);
  13. }
  14. );
  15. /**
  16. * Schedules a large video update when the streaming status of the track associated with the large video changes.
  17. */
  18. StateListenerRegistry.register(
  19. /* selector */ state => {
  20. const largeVideoParticipant = getLargeVideoParticipant(state);
  21. const videoTrack = getVideoTrackByParticipant(state, largeVideoParticipant);
  22. return {
  23. participantId: largeVideoParticipant?.id,
  24. streamingStatus: videoTrack?.streamingStatus
  25. };
  26. },
  27. /* listener */ ({ participantId, streamingStatus }, previousState: any = {}) => {
  28. if (streamingStatus !== previousState.streamingStatus) {
  29. VideoLayout.updateLargeVideo(participantId, true);
  30. }
  31. }, {
  32. deepEquals: true
  33. }
  34. );