Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

middleware.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* @flow */
  2. import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
  3. import { CONFERENCE_JOINED } from '../base/conference';
  4. import { i18next } from '../base/i18n';
  5. import { MiddlewareRegistry } from '../base/redux';
  6. import { showNotification } from '../notifications';
  7. import { recordingController } from './controller';
  8. import { signalLocalRecordingEngagement } from './actions';
  9. MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
  10. const result = next(action);
  11. switch (action.type) {
  12. case CONFERENCE_JOINED: {
  13. const { conference } = getState()['features/base/conference'];
  14. recordingController.registerEvents(conference);
  15. break;
  16. }
  17. case APP_WILL_MOUNT:
  18. // realize the delegates on recordingController,
  19. // providing UI reactions.
  20. recordingController.onStateChanged = function(state) {
  21. dispatch(signalLocalRecordingEngagement(state));
  22. };
  23. recordingController.onWarning = function(message) {
  24. dispatch(showNotification({
  25. title: i18next.t('localRecording.localRecording'),
  26. description: message
  27. }, 10000));
  28. };
  29. recordingController.onNotify = function(message) {
  30. dispatch(showNotification({
  31. title: i18next.t('localRecording.localRecording'),
  32. description: message
  33. }, 10000));
  34. };
  35. break;
  36. case APP_WILL_UNMOUNT:
  37. recordingController.onStateChanged = null;
  38. recordingController.onNotify = null;
  39. recordingController.onWarning = null;
  40. break;
  41. }
  42. // @todo: detect change in features/base/settings micDeviceID
  43. // @todo: SET_AUDIO_MUTED, when audio is muted
  44. return result;
  45. });