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

actions.web.ts 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { IStore } from '../../app/types';
  2. import { showWarningNotification } from '../../notifications/actions';
  3. import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
  4. import { stopLocalVideoRecording } from '../../recording/actions.any';
  5. import LocalRecordingManager from '../../recording/components/Recording/LocalRecordingManager.web';
  6. import { configureInitialDevices } from '../devices/actions';
  7. import { getBackendSafeRoomName } from '../util/uri';
  8. export {
  9. connectionDisconnected,
  10. connectionEstablished,
  11. connectionFailed,
  12. setLocationURL
  13. } from './actions.any';
  14. import logger from './logger';
  15. export * from './actions.any';
  16. /**
  17. * Opens new connection.
  18. *
  19. * @returns {Promise<JitsiConnection>}
  20. */
  21. export function connect() {
  22. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  23. const room = getBackendSafeRoomName(getState()['features/base/conference'].room);
  24. // XXX For web based version we use conference initialization logic
  25. // from the old app (at the moment of writing).
  26. return dispatch(configureInitialDevices()).then(
  27. () => APP.conference.init({
  28. roomName: room
  29. }).catch((error: Error) => {
  30. APP.API.notifyConferenceLeft(APP.conference.roomName);
  31. logger.error(error);
  32. }));
  33. };
  34. }
  35. /**
  36. * Closes connection.
  37. *
  38. * @param {boolean} [requestFeedback] - Whether or not to attempt showing a
  39. * request for call feedback.
  40. * @returns {Function}
  41. */
  42. export function disconnect(requestFeedback = false) {
  43. // XXX For web based version we use conference hanging up logic from the old
  44. // app.
  45. return async (dispatch: IStore['dispatch']) => {
  46. if (LocalRecordingManager.isRecordingLocally()) {
  47. dispatch(stopLocalVideoRecording());
  48. dispatch(showWarningNotification({
  49. titleKey: 'localRecording.stopping',
  50. descriptionKey: 'localRecording.wait'
  51. }, NOTIFICATION_TIMEOUT_TYPE.STICKY));
  52. // wait 1000ms for the recording to end and start downloading
  53. await new Promise(res => {
  54. setTimeout(res, 1000);
  55. });
  56. }
  57. return APP.conference.hangup(requestFeedback);
  58. };
  59. }