您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

actions.web.js 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import { libInitError, WEBRTC_NOT_SUPPORTED } from '../lib-jitsi-meet';
  4. declare var APP: Object;
  5. declare var config: Object;
  6. const logger = require('jitsi-meet-logger').getLogger(__filename);
  7. export {
  8. connectionEstablished,
  9. connectionFailed,
  10. setLocationURL
  11. } from './actions.native';
  12. /**
  13. * Opens new connection.
  14. *
  15. * @returns {Promise<JitsiConnection>}
  16. */
  17. export function connect() {
  18. return (dispatch: Dispatch<*>, getState: Function) => {
  19. const state = getState();
  20. // XXX Lib-jitsi-meet does not accept uppercase letters.
  21. const room = state['features/base/conference'].room.toLowerCase();
  22. const { initPromise } = state['features/base/lib-jitsi-meet'];
  23. // XXX For web based version we use conference initialization logic
  24. // from the old app (at the moment of writing).
  25. return initPromise.then(() => APP.conference.init({
  26. roomName: room
  27. })).catch(error => {
  28. APP.API.notifyConferenceLeft(APP.conference.roomName);
  29. logger.error(error);
  30. // TODO The following are in fact Errors raised by
  31. // JitsiMeetJS.init() which should be taken care of in
  32. // features/base/lib-jitsi-meet but we are not there yet on the
  33. // Web at the time of this writing.
  34. switch (error.name) {
  35. case WEBRTC_NOT_SUPPORTED:
  36. dispatch(libInitError(error));
  37. }
  38. });
  39. };
  40. }
  41. /**
  42. * Closes connection.
  43. *
  44. * @param {boolean} [requestFeedback] - Whether or not to attempt showing a
  45. * request for call feedback.
  46. * @returns {Function}
  47. */
  48. export function disconnect(requestFeedback: boolean = false) {
  49. // XXX For web based version we use conference hanging up logic from the old
  50. // app.
  51. return () => APP.conference.hangup(requestFeedback);
  52. }