Add conference actions
This commit is contained in:
parent
84a2c51f9c
commit
d46c60e688
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* The type of (redux) action that is dispatched when conference is joined.
|
||||
*
|
||||
* {
|
||||
* type: CONFERENCE_JOINED,
|
||||
* conference: Object
|
||||
* }
|
||||
*/
|
||||
export const CONFERENCE_JOINED = Symbol('CONFERENCE_JOINED');
|
||||
|
||||
/**
|
||||
* The type of (redux) action that is dispatched when conference ends.
|
||||
*
|
||||
* {
|
||||
* type: CONFERENCE_ENDED,
|
||||
* conference: Object
|
||||
* }
|
||||
*/export const CONFERENCE_ENDED = Symbol('CONFERENCE_ENDED');
|
|
@ -0,0 +1,35 @@
|
|||
// @flow
|
||||
|
||||
import { CONFERENCE_JOINED, CONFERENCE_ENDED } from './actionTypes';
|
||||
|
||||
/**
|
||||
* Notifies that conference is joined.
|
||||
*
|
||||
* @param {Object} conference - Conference Details.
|
||||
* @returns {{
|
||||
* type: CONFERENCE_JOINED,
|
||||
* conference: Object
|
||||
* }}
|
||||
*/
|
||||
export function conferenceJoined(conference: Object) {
|
||||
return {
|
||||
type: CONFERENCE_JOINED,
|
||||
conference
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies that conference is joined.
|
||||
*
|
||||
* @param {Object} conference - Conference Details.
|
||||
* @returns {{
|
||||
* type: CONFERENCE_ENDED,
|
||||
* conference: Object
|
||||
* }}
|
||||
*/
|
||||
export function conferenceEnded(conference: Object) {
|
||||
return {
|
||||
type: CONFERENCE_ENDED,
|
||||
conference
|
||||
};
|
||||
}
|
|
@ -18,6 +18,7 @@ import {
|
|||
import config from '../../config';
|
||||
import { setEmail, setName } from '../../settings';
|
||||
|
||||
import { conferenceEnded, conferenceJoined } from '../actions';
|
||||
import { LoadingIndicator, Wrapper } from '../styled';
|
||||
import { getExternalApiURL } from '../../utils';
|
||||
|
||||
|
@ -86,6 +87,11 @@ class Conference extends Component<Props, State> {
|
|||
*/
|
||||
_api: Object;
|
||||
|
||||
/**
|
||||
* Conference Object.
|
||||
*/
|
||||
_conference: Object;
|
||||
|
||||
/**
|
||||
* Initializes a new {@code Conference} instance.
|
||||
*
|
||||
|
@ -119,10 +125,15 @@ class Conference extends Component<Props, State> {
|
|||
|| this.props._serverURL
|
||||
|| config.defaultServerURL;
|
||||
|
||||
this._conference = {
|
||||
room,
|
||||
serverURL
|
||||
};
|
||||
|
||||
const script = document.createElement('script');
|
||||
|
||||
script.async = true;
|
||||
script.onload = () => this._onScriptLoad(parentNode, room, serverURL);
|
||||
script.onload = () => this._onScriptLoad(parentNode);
|
||||
script.onerror = (event: Event) =>
|
||||
this._navigateToHome(event, room, serverURL);
|
||||
script.src = getExternalApiURL(serverURL);
|
||||
|
@ -210,14 +221,12 @@ class Conference extends Component<Props, State> {
|
|||
* and attach utils from jitsi-meet-electron-utils.
|
||||
*
|
||||
* @param {Object} parentNode - Node to which iframe has to be attached.
|
||||
* @param {string} roomName - Conference room name to be joined.
|
||||
* @param {string} serverURL - Jitsi Meet server url.
|
||||
* @returns {void}
|
||||
*/
|
||||
_onScriptLoad(parentNode: Object, roomName: string, serverURL: string) {
|
||||
_onScriptLoad(parentNode: Object) {
|
||||
const JitsiMeetExternalAPI = window.JitsiMeetExternalAPI;
|
||||
|
||||
const host = serverURL.replace(/https?:\/\//, '');
|
||||
const host = this._conference.serverURL.replace(/https?:\/\//, '');
|
||||
|
||||
const configOverwrite = {
|
||||
startWithAudioMuted: this.props._startWithAudioMuted,
|
||||
|
@ -228,7 +237,7 @@ class Conference extends Component<Props, State> {
|
|||
configOverwrite,
|
||||
onload: this._onIframeLoad,
|
||||
parentNode,
|
||||
roomName
|
||||
roomName: this._conference.room
|
||||
});
|
||||
initPopupsConfigurationRender(this._api);
|
||||
|
||||
|
@ -239,11 +248,16 @@ class Conference extends Component<Props, State> {
|
|||
setupAlwaysOnTopRender(this._api);
|
||||
setupWiFiStats(iframe);
|
||||
|
||||
this._api.on('readyToClose', (event: Event) =>
|
||||
this._navigateToHome(event));
|
||||
this._api.on('readyToClose', (event: Event) => {
|
||||
this.props.dispatch(conferenceEnded(this._conference));
|
||||
this._navigateToHome(event);
|
||||
});
|
||||
this._api.on('videoConferenceJoined',
|
||||
(conferenceInfo: Object) =>
|
||||
this._onVideoConferenceJoined(conferenceInfo));
|
||||
(conferenceInfo: Object) => {
|
||||
this.props.dispatch(conferenceJoined(this._conference));
|
||||
this._onVideoConferenceJoined(conferenceInfo);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
export * from './actions';
|
||||
export * from './actionTypes';
|
||||
export * from './components';
|
||||
export * from './styled';
|
||||
|
||||
|
|
Loading…
Reference in New Issue