Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

actions.web.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* @flow */
  2. import type { Dispatch } from 'redux';
  3. import UIEvents from '../../../../service/UI/UIEvents';
  4. import { SET_DOMAIN } from './actionTypes';
  5. declare var APP: Object;
  6. declare var JitsiMeetJS: Object;
  7. const JitsiConferenceEvents = JitsiMeetJS.events.conference;
  8. const logger = require('jitsi-meet-logger').getLogger(__filename);
  9. export {
  10. connectionEstablished,
  11. connectionFailed
  12. } from './actions.native.js';
  13. /**
  14. * Opens new connection.
  15. *
  16. * @returns {Promise<JitsiConnection>}
  17. */
  18. export function connect() {
  19. return (dispatch: Dispatch<*>, getState: Function) => {
  20. const state = getState();
  21. // XXX Lib-jitsi-meet does not accept uppercase letters.
  22. const room = state['features/base/conference'].room.toLowerCase();
  23. // XXX For web based version we use conference initialization logic
  24. // from the old app (at the moment of writing).
  25. return APP.conference.init({ roomName: room }).then(() => {
  26. if (APP.logCollector) {
  27. // Start the LogCollector's periodic "store logs" task
  28. APP.logCollector.start();
  29. APP.logCollectorStarted = true;
  30. // Make an attempt to flush in case a lot of logs have been
  31. // cached, before the collector was started.
  32. APP.logCollector.flush();
  33. // This event listener will flush the logs, before
  34. // the statistics module (CallStats) is stopped.
  35. //
  36. // NOTE The LogCollector is not stopped, because this event can
  37. // be triggered multiple times during single conference
  38. // (whenever statistics module is stopped). That includes
  39. // the case when Jicofo terminates the single person left in the
  40. // room. It will then restart the media session when someone
  41. // eventually join the room which will start the stats again.
  42. APP.conference.addConferenceListener(
  43. JitsiConferenceEvents.BEFORE_STATISTICS_DISPOSED,
  44. () => {
  45. if (APP.logCollector) {
  46. APP.logCollector.flush();
  47. }
  48. }
  49. );
  50. }
  51. APP.UI.initConference();
  52. APP.UI.addListener(UIEvents.LANG_CHANGED, language => {
  53. APP.translation.setLanguage(language);
  54. APP.settings.setLanguage(language);
  55. });
  56. APP.keyboardshortcut.init();
  57. })
  58. .catch(err => {
  59. APP.UI.hideRingOverLay();
  60. APP.API.notifyConferenceLeft(APP.conference.roomName);
  61. logger.error(err);
  62. });
  63. };
  64. }
  65. /**
  66. * Closes connection.
  67. *
  68. * @returns {Function}
  69. */
  70. export function disconnect() {
  71. // XXX For web based version we use conference hanging up logic from the old
  72. // app.
  73. return () => APP.conference.hangup();
  74. }
  75. /**
  76. * Sets connection domain.
  77. *
  78. * @param {string} domain - Domain name.
  79. * @returns {{
  80. * type: SET_DOMAIN,
  81. * domain: string
  82. * }}
  83. */
  84. export function setDomain(domain: string) {
  85. return {
  86. type: SET_DOMAIN,
  87. domain
  88. };
  89. }