From b8ed209893cde7a9dcf757974f2cdc52d419848f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 10 Oct 2018 10:20:44 +0200 Subject: [PATCH] Fix regression when conference has a password or auth This partially reverts eec6a270c5b2c7c93891dee1f9b49cfd351f7cff. 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. --- .../conference/components/Conference.js | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/app/features/conference/components/Conference.js b/app/features/conference/components/Conference.js index 09f819d..1ee0ea5 100644 --- a/app/features/conference/components/Conference.js +++ b/app/features/conference/components/Conference.js @@ -110,6 +110,8 @@ class Conference extends Component { }; this._ref = React.createRef(); + + this._onIframeLoad = this._onIframeLoad.bind(this); } /** @@ -139,7 +141,8 @@ class Conference extends Component { 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 { this._api = new JitsiMeetExternalAPI(host, { configOverwrite, + onload: this._onIframeLoad, parentNode, roomName: this._conference.room }); @@ -300,14 +304,14 @@ class Conference extends Component { } } + _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 { 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);