Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

subscriber.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // @flow
  2. import { MEDIA_TYPE, VIDEO_TYPE } from '../base/media';
  3. import { getLocalParticipant } from '../base/participants';
  4. import { StateListenerRegistry } from '../base/redux';
  5. import { getTrackByMediaTypeAndParticipant } from '../base/tracks';
  6. import { appendSuffix } from '../display-name';
  7. import { shouldDisplayTileView } from '../video-layout';
  8. declare var APP: Object;
  9. declare var interfaceConfig: Object;
  10. /**
  11. * StateListenerRegistry provides a reliable way of detecting changes to
  12. * preferred layout state and dispatching additional actions.
  13. */
  14. StateListenerRegistry.register(
  15. /* selector */ state => shouldDisplayTileView(state),
  16. /* listener */ displayTileView => {
  17. APP.API.notifyTileViewChanged(displayTileView);
  18. });
  19. StateListenerRegistry.register(
  20. /* selector */ state => state['features/base/settings'].displayName,
  21. /* listener */ (displayName, store) => {
  22. const localParticipant = getLocalParticipant(store.getState());
  23. // Initial setting of the display name occurs happens on app
  24. // initialization, before the local participant is ready. The initial
  25. // settings is not desired to be fired anyways, only changes.
  26. if (localParticipant) {
  27. const { id } = localParticipant;
  28. APP.API.notifyDisplayNameChanged(id, {
  29. displayName,
  30. formattedDisplayName: appendSuffix(
  31. displayName,
  32. interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME)
  33. });
  34. }
  35. });
  36. /**
  37. * Updates the on stage participant value.
  38. */
  39. StateListenerRegistry.register(
  40. /* selector */ state => state['features/large-video'].participantId,
  41. /* listener */ (participantId, store) => {
  42. const videoTrack = getTrackByMediaTypeAndParticipant(
  43. store.getState()['features/base/tracks'], MEDIA_TYPE.VIDEO, participantId);
  44. if (videoTrack && videoTrack.videoType === VIDEO_TYPE.CAMERA) {
  45. APP.API.notifyOnStageParticipantChanged(participantId);
  46. }
  47. }
  48. );