Fix regression when conference has a password or auth

This partially reverts eec6a270c5.

The problem is that when a conference is protected by a password or has
auth enabled, the "joined" event will come later, when the user
authenticates, so the 10s timeout will kick in.

This is not ideal because we react to the onLoad event of an iframe,
which doesn't tell us much of *what* is actually loaded, but a new event
would be required to properly fix this.
This commit is contained in:
Saúl Ibarra Corretgé 2018-10-10 10:20:44 +02:00 committed by Hristo Terezov
parent da8f51dc51
commit b8ed209893
1 changed files with 18 additions and 5 deletions

View File

@ -110,6 +110,8 @@ class Conference extends Component<Props, State> {
};
this._ref = React.createRef();
this._onIframeLoad = this._onIframeLoad.bind(this);
}
/**
@ -139,7 +141,8 @@ class Conference extends Component<Props, State> {
this._ref.current.appendChild(script);
// Set a timer for 10s, if we haven't joined by then, give up.
// Set a timer for 10s, if we haven't loaded the iframe by then,
// give up.
this._loadTimer = setTimeout(() => {
this._navigateToHome(
@ -250,6 +253,7 @@ class Conference extends Component<Props, State> {
this._api = new JitsiMeetExternalAPI(host, {
configOverwrite,
onload: this._onIframeLoad,
parentNode,
roomName: this._conference.room
});
@ -300,14 +304,14 @@ class Conference extends Component<Props, State> {
}
}
_onIframeLoad: (*) => void;
/**
* Saves conference info on joining it.
* Sets state of loading to false when iframe has completely loaded.
*
* @param {Object} conferenceInfo - Contains information about the current
* conference.
* @returns {void}
*/
_onVideoConferenceJoined(conferenceInfo: Object) {
_onIframeLoad() {
if (this._loadTimer) {
clearTimeout(this._loadTimer);
this._loadTimer = null;
@ -316,7 +320,16 @@ class Conference extends Component<Props, State> {
this.setState({
isLoading: false
});
}
/**
* Saves conference info on joining it.
*
* @param {Object} conferenceInfo - Contains information about the current
* conference.
* @returns {void}
*/
_onVideoConferenceJoined(conferenceInfo: Object) {
setupDragAreas(this._api.getIFrame());
this._setAvatarURL(this.props._avatarURL);