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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { ReducerRegistry } from '../redux';
  2. import {
  3. LIB_DISPOSED,
  4. LIB_INIT_ERROR,
  5. LIB_INITIALIZED,
  6. SET_CONFIG
  7. } from './actionTypes';
  8. /**
  9. * Initial state of 'features/base/lib-jitsi-meet'.
  10. *
  11. * @type {{
  12. * initializationError: null,
  13. * initialized: boolean
  14. * }}
  15. */
  16. const INITIAL_STATE = {
  17. config: {
  18. // FIXME The support for audio levels in lib-jitsi-meet polls the
  19. // statistics of WebRTC at a short interval multiple times a second.
  20. // Unfortunately, React Native is slow to fetch these statistics from
  21. // the native WebRTC API, through the React Native bridge and eventually
  22. // to JavaScript. Because the audio levels are of no interest to the
  23. // mobile app, it is fastest to merely disable them.
  24. disableAudioLevels: true,
  25. // FIXME Lib-jitsi-meet uses HTML script elements to asynchronously load
  26. // certain pieces of JavaScript. Unfortunately, the technique doesn't
  27. // work on React Native (because there are no HTML elements in the first
  28. // place). Fortunately, these pieces of JavaScript currently involve
  29. // third parties and we can temporarily disable them (until we implement
  30. // an alternative to async script elements on React Native).
  31. disableThirdPartyRequests: true
  32. },
  33. initializationError: null,
  34. initialized: false
  35. };
  36. ReducerRegistry.register(
  37. 'features/base/lib-jitsi-meet',
  38. (state = INITIAL_STATE, action) => {
  39. switch (action.type) {
  40. case LIB_DISPOSED:
  41. return INITIAL_STATE;
  42. case LIB_INIT_ERROR:
  43. return {
  44. ...state,
  45. initializationError: action.lib.error,
  46. initialized: false
  47. };
  48. case LIB_INITIALIZED:
  49. return {
  50. ...state,
  51. initializationError: null,
  52. initialized: true
  53. };
  54. case SET_CONFIG:
  55. return {
  56. ...state,
  57. config: {
  58. ...action.config,
  59. ...state.config
  60. }
  61. };
  62. default:
  63. return state;
  64. }
  65. });