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.

middleware.native.ts 1003B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import {
  2. MEDIA_TYPE,
  3. VIDEO_TYPE
  4. } from '../media/constants';
  5. import MiddlewareRegistry from '../redux/MiddlewareRegistry';
  6. import {
  7. TRACK_UPDATED
  8. } from './actionTypes';
  9. import {
  10. toggleScreensharing
  11. } from './actions.native';
  12. import './middleware.any';
  13. /**
  14. * Middleware that captures LIB_DID_DISPOSE and LIB_DID_INIT actions and,
  15. * respectively, creates/destroys local media tracks. Also listens to
  16. * media-related actions and performs corresponding operations with tracks.
  17. *
  18. * @param {Store} store - The redux store.
  19. * @returns {Function}
  20. */
  21. MiddlewareRegistry.register(store => next => action => {
  22. switch (action.type) {
  23. case TRACK_UPDATED: {
  24. const { jitsiTrack, local } = action.track;
  25. if (local && jitsiTrack.isMuted()
  26. && jitsiTrack.type === MEDIA_TYPE.VIDEO && jitsiTrack.videoType === VIDEO_TYPE.DESKTOP) {
  27. store.dispatch(toggleScreensharing(false));
  28. }
  29. break;
  30. }
  31. }
  32. return next(action);
  33. });