mirror of
https://github.com/netzbegruenung/jitsi-meet-electron.git
synced 2024-05-03 09:13:43 +02:00
Add a 10s join timeout
This commit is contained in:
parent
eec6a270c5
commit
cc91dae90b
|
@ -77,11 +77,6 @@ type State = {
|
||||||
* Conference component.
|
* Conference component.
|
||||||
*/
|
*/
|
||||||
class Conference extends Component<Props, State> {
|
class Conference extends Component<Props, State> {
|
||||||
/**
|
|
||||||
* Reference to the element of this component.
|
|
||||||
*/
|
|
||||||
_ref: Object;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* External API object.
|
* External API object.
|
||||||
*/
|
*/
|
||||||
|
@ -92,6 +87,16 @@ class Conference extends Component<Props, State> {
|
||||||
*/
|
*/
|
||||||
_conference: Object;
|
_conference: Object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timer to cancel the joining if it takes too long.
|
||||||
|
*/
|
||||||
|
_loadTimer: ?TimeoutID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to the element of this component.
|
||||||
|
*/
|
||||||
|
_ref: Object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new {@code Conference} instance.
|
* Initializes a new {@code Conference} instance.
|
||||||
*
|
*
|
||||||
|
@ -137,6 +142,19 @@ class Conference extends Component<Props, State> {
|
||||||
script.src = getExternalApiURL(serverURL);
|
script.src = getExternalApiURL(serverURL);
|
||||||
|
|
||||||
this._ref.current.appendChild(script);
|
this._ref.current.appendChild(script);
|
||||||
|
|
||||||
|
// Set a timer for 10s, if we haven't joined by then, give up.
|
||||||
|
this._loadTimer = setTimeout(() => {
|
||||||
|
this._navigateToHome(
|
||||||
|
|
||||||
|
// $FlowFixMe
|
||||||
|
{
|
||||||
|
error: 'Loading error',
|
||||||
|
type: 'error'
|
||||||
|
},
|
||||||
|
room,
|
||||||
|
serverURL);
|
||||||
|
}, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,6 +183,9 @@ class Conference extends Component<Props, State> {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
if (this._loadTimer) {
|
||||||
|
clearTimeout(this._loadTimer);
|
||||||
|
}
|
||||||
if (this._api) {
|
if (this._api) {
|
||||||
this._api.dispose();
|
this._api.dispose();
|
||||||
}
|
}
|
||||||
|
@ -291,6 +312,11 @@ class Conference extends Component<Props, State> {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
_onVideoConferenceJoined(conferenceInfo: Object) {
|
_onVideoConferenceJoined(conferenceInfo: Object) {
|
||||||
|
if (this._loadTimer) {
|
||||||
|
clearTimeout(this._loadTimer);
|
||||||
|
this._loadTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isLoading: false
|
isLoading: false
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue