Add CONFERENCE_WILL_JOIN action

It's fired before creating the conference with lib-jitsi-meet.
This commit is contained in:
Saúl Ibarra Corretgé 2017-01-18 13:28:52 -06:00 committed by Lyubomir Marinov
parent 5baa167a08
commit b1b5f3e6f0
2 changed files with 38 additions and 3 deletions

View File

@ -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.

View File

@ -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);