mirror of
https://github.com/netzbegruenung/jitsi-meet-electron.git
synced 2024-05-05 10:13:41 +02:00
Add conference actions
This commit is contained in:
parent
84a2c51f9c
commit
d46c60e688
18
app/features/conference/actionTypes.js
Normal file
18
app/features/conference/actionTypes.js
Normal file
|
@ -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');
|
35
app/features/conference/actions.js
Normal file
35
app/features/conference/actions.js
Normal file
|
@ -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 config from '../../config';
|
||||||
import { setEmail, setName } from '../../settings';
|
import { setEmail, setName } from '../../settings';
|
||||||
|
|
||||||
|
import { conferenceEnded, conferenceJoined } from '../actions';
|
||||||
import { LoadingIndicator, Wrapper } from '../styled';
|
import { LoadingIndicator, Wrapper } from '../styled';
|
||||||
import { getExternalApiURL } from '../../utils';
|
import { getExternalApiURL } from '../../utils';
|
||||||
|
|
||||||
|
@ -86,6 +87,11 @@ class Conference extends Component<Props, State> {
|
||||||
*/
|
*/
|
||||||
_api: Object;
|
_api: Object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Conference Object.
|
||||||
|
*/
|
||||||
|
_conference: Object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new {@code Conference} instance.
|
* Initializes a new {@code Conference} instance.
|
||||||
*
|
*
|
||||||
|
@ -119,10 +125,15 @@ class Conference extends Component<Props, State> {
|
||||||
|| this.props._serverURL
|
|| this.props._serverURL
|
||||||
|| config.defaultServerURL;
|
|| config.defaultServerURL;
|
||||||
|
|
||||||
|
this._conference = {
|
||||||
|
room,
|
||||||
|
serverURL
|
||||||
|
};
|
||||||
|
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
|
|
||||||
script.async = true;
|
script.async = true;
|
||||||
script.onload = () => this._onScriptLoad(parentNode, room, serverURL);
|
script.onload = () => this._onScriptLoad(parentNode);
|
||||||
script.onerror = (event: Event) =>
|
script.onerror = (event: Event) =>
|
||||||
this._navigateToHome(event, room, serverURL);
|
this._navigateToHome(event, room, serverURL);
|
||||||
script.src = getExternalApiURL(serverURL);
|
script.src = getExternalApiURL(serverURL);
|
||||||
|
@ -210,14 +221,12 @@ class Conference extends Component<Props, State> {
|
||||||
* and attach utils from jitsi-meet-electron-utils.
|
* and attach utils from jitsi-meet-electron-utils.
|
||||||
*
|
*
|
||||||
* @param {Object} parentNode - Node to which iframe has to be attached.
|
* @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}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
_onScriptLoad(parentNode: Object, roomName: string, serverURL: string) {
|
_onScriptLoad(parentNode: Object) {
|
||||||
const JitsiMeetExternalAPI = window.JitsiMeetExternalAPI;
|
const JitsiMeetExternalAPI = window.JitsiMeetExternalAPI;
|
||||||
|
|
||||||
const host = serverURL.replace(/https?:\/\//, '');
|
const host = this._conference.serverURL.replace(/https?:\/\//, '');
|
||||||
|
|
||||||
const configOverwrite = {
|
const configOverwrite = {
|
||||||
startWithAudioMuted: this.props._startWithAudioMuted,
|
startWithAudioMuted: this.props._startWithAudioMuted,
|
||||||
|
@ -228,7 +237,7 @@ class Conference extends Component<Props, State> {
|
||||||
configOverwrite,
|
configOverwrite,
|
||||||
onload: this._onIframeLoad,
|
onload: this._onIframeLoad,
|
||||||
parentNode,
|
parentNode,
|
||||||
roomName
|
roomName: this._conference.room
|
||||||
});
|
});
|
||||||
initPopupsConfigurationRender(this._api);
|
initPopupsConfigurationRender(this._api);
|
||||||
|
|
||||||
|
@ -239,11 +248,16 @@ class Conference extends Component<Props, State> {
|
||||||
setupAlwaysOnTopRender(this._api);
|
setupAlwaysOnTopRender(this._api);
|
||||||
setupWiFiStats(iframe);
|
setupWiFiStats(iframe);
|
||||||
|
|
||||||
this._api.on('readyToClose', (event: Event) =>
|
this._api.on('readyToClose', (event: Event) => {
|
||||||
this._navigateToHome(event));
|
this.props.dispatch(conferenceEnded(this._conference));
|
||||||
|
this._navigateToHome(event);
|
||||||
|
});
|
||||||
this._api.on('videoConferenceJoined',
|
this._api.on('videoConferenceJoined',
|
||||||
(conferenceInfo: Object) =>
|
(conferenceInfo: Object) => {
|
||||||
this._onVideoConferenceJoined(conferenceInfo));
|
this.props.dispatch(conferenceJoined(this._conference));
|
||||||
|
this._onVideoConferenceJoined(conferenceInfo);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
export * from './actions';
|
||||||
|
export * from './actionTypes';
|
||||||
export * from './components';
|
export * from './components';
|
||||||
export * from './styled';
|
export * from './styled';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue