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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { getLocalParticipant } from '../base/participants/functions';
  2. import StateListenerRegistry from '../base/redux/StateListenerRegistry';
  3. import { appendSuffix } from '../display-name/functions';
  4. import { shouldDisplayTileView } from '../video-layout/functions';
  5. /**
  6. * StateListenerRegistry provides a reliable way of detecting changes to
  7. * preferred layout state and dispatching additional actions.
  8. */
  9. StateListenerRegistry.register(
  10. /* selector */ state => shouldDisplayTileView(state),
  11. /* listener */ displayTileView => {
  12. APP.API.notifyTileViewChanged(displayTileView);
  13. });
  14. StateListenerRegistry.register(
  15. /* selector */ state => state['features/base/settings'].displayName,
  16. /* listener */ (displayName, store) => {
  17. const localParticipant = getLocalParticipant(store.getState());
  18. const { defaultLocalDisplayName } = store.getState()['features/base/config'];
  19. // Initial setting of the display name happens on app
  20. // initialization, before the local participant is ready. The initial
  21. // settings is not desired to be fired anyways, only changes.
  22. if (localParticipant) {
  23. const { id } = localParticipant;
  24. APP.API.notifyDisplayNameChanged(id, {
  25. displayName,
  26. formattedDisplayName: appendSuffix(
  27. displayName,
  28. defaultLocalDisplayName
  29. )
  30. });
  31. }
  32. });
  33. StateListenerRegistry.register(
  34. /* selector */ state => state['features/base/settings'].email,
  35. /* listener */ (email, store) => {
  36. const localParticipant = getLocalParticipant(store.getState());
  37. // Initial setting of the email happens on app
  38. // initialization, before the local participant is ready. The initial
  39. // settings is not desired to be fired anyways, only changes.
  40. if (localParticipant) {
  41. const { id } = localParticipant;
  42. APP.API.notifyEmailChanged(id, {
  43. email
  44. });
  45. }
  46. });
  47. /**
  48. * Updates the on stage participant value.
  49. */
  50. StateListenerRegistry.register(
  51. /* selector */ state => state['features/large-video'].participantId,
  52. /* listener */ participantId => {
  53. APP.API.notifyOnStageParticipantChanged(participantId);
  54. }
  55. );
  56. /**
  57. * Updates the on audio only value.
  58. */
  59. StateListenerRegistry.register(
  60. /* selector */ state => state['features/base/audio-only'].enabled,
  61. /* listener */ enabled => {
  62. APP.API.notifyAudioOnlyChanged(enabled);
  63. }
  64. );