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.

reducer.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* @flow */
  2. import { ReducerRegistry } from '../base/redux';
  3. import {
  4. LOCAL_RECORDING_ENGAGED,
  5. LOCAL_RECORDING_STATS_UPDATE,
  6. LOCAL_RECORDING_TOGGLE_DIALOG,
  7. LOCAL_RECORDING_UNENGAGED
  8. } from './actionTypes';
  9. import { recordingController } from './controller';
  10. ReducerRegistry.register('features/local-recording', (state = {}, action) => {
  11. switch (action.type) {
  12. case LOCAL_RECORDING_ENGAGED: {
  13. return {
  14. ...state,
  15. isEngaged: true,
  16. recordingStartedAt: new Date(Date.now()),
  17. encodingFormat: recordingController._format
  18. };
  19. }
  20. case LOCAL_RECORDING_UNENGAGED:
  21. return {
  22. ...state,
  23. isEngaged: false,
  24. recordingStartedAt: null
  25. };
  26. case LOCAL_RECORDING_TOGGLE_DIALOG:
  27. return {
  28. ...state,
  29. showDialog: state.showDialog === undefined
  30. || state.showDialog === false
  31. };
  32. case LOCAL_RECORDING_STATS_UPDATE:
  33. return {
  34. ...state,
  35. stats: action.stats
  36. };
  37. default:
  38. return state;
  39. }
  40. });