From b1b5f3e6f0755355cd7e98176d756dbb7eba0c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 18 Jan 2017 13:28:52 -0600 Subject: [PATCH] Add CONFERENCE_WILL_JOIN action It's fired before creating the conference with lib-jitsi-meet. --- react/features/base/conference/actionTypes.js | 11 +++++++ react/features/base/conference/actions.js | 30 +++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/react/features/base/conference/actionTypes.js b/react/features/base/conference/actionTypes.js index 3dac9614d..2624c341e 100644 --- a/react/features/base/conference/actionTypes.js +++ b/react/features/base/conference/actionTypes.js @@ -23,6 +23,17 @@ export const CONFERENCE_FAILED = Symbol('CONFERENCE_FAILED'); */ export const CONFERENCE_JOINED = Symbol('CONFERENCE_JOINED'); +/** + * The type of the Redux action which signals that a specific conference will be + * joined. + * + * { + * type: CONFERENCE_WILL_JOIN, + * room: string + * } + */ +export const CONFERENCE_WILL_JOIN = Symbol('CONFERENCE_WILL_JOIN'); + /** * The type of the Redux action which signals that a specific conference has * been left. diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.js index 4eb5af95f..39547ee46 100644 --- a/react/features/base/conference/actions.js +++ b/react/features/base/conference/actions.js @@ -12,6 +12,7 @@ import { CONFERENCE_FAILED, CONFERENCE_JOINED, CONFERENCE_LEFT, + CONFERENCE_WILL_JOIN, CONFERENCE_WILL_LEAVE, LOCK_STATE_CHANGED, SET_PASSWORD, @@ -123,6 +124,26 @@ function _conferenceJoined(conference) { }; } +/** + * Signals the intention of the application to have the local participant leave + * a specific conference. Similar in fashion to CONFERENCE_LEFT. Contrary to it + * though, it's not guaranteed because CONFERENCE_LEFT may be triggered by + * lib-jitsi-meet and not the application. + * + * @param {string} room - The JitsiConference instance which will + * be left by the local participant. + * @returns {{ + * type: CONFERENCE_WILL_JOIN, + * room: string + * }} + */ +function _conferenceWillJoin(room) { + return { + type: CONFERENCE_WILL_JOIN, + room + }; +} + /** * Signals that a specific conference has been left. * @@ -180,12 +201,15 @@ export function createConference() { throw new Error('Cannot join conference without room name'); } + // XXX Lib-jitsi-meet does not accept uppercase letters. + const _room = room.toLowerCase(); + + dispatch(_conferenceWillJoin(_room)); + // TODO Take options from config. const conference = connection.initJitsiConference( - - // XXX Lib-jitsi-meet does not accept uppercase letters. - room.toLowerCase(), + _room, { openSctp: true }); _addConferenceListeners(conference, dispatch);