Skip to content

Commit

Permalink
fix(conference) fix not loading with older server versions
Browse files Browse the repository at this point in the history
Use an iframe event which is fired really early to detect if the iframe
was loaded.

Incidentally the logic to detect if the iframe was actually loaded gets
simplified now, since the only way for the event to be received is for
the iframe to be loaded.

Fixes: #929
  • Loading branch information
saghul committed Nov 24, 2023
1 parent 22adc4b commit 5cbdc32
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions app/features/conference/components/Conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ class Conference extends Component<Props, State> {

const options = {
configOverwrite,
onload: this._onIframeLoad,
parentNode: this._ref.current,
roomName,
sandbox: 'allow-scripts allow-same-origin allow-popups allow-forms'
Expand All @@ -241,6 +240,11 @@ class Conference extends Component<Props, State> {
...urlParameters
});

// This event is fired really early, at the same time as 'ready', but has been
// around for longer.
// TODO: remove after a while. -saghul
this._api.on('browserSupport', this._onIframeLoad);

this._api.on('suspendDetected', this._onVideoConferenceEnded);
this._api.on('readyToClose', this._onVideoConferenceEnded);
this._api.on('videoConferenceJoined',
Expand Down Expand Up @@ -323,25 +327,6 @@ class Conference extends Component<Props, State> {
this._loadTimer = null;
}

const frame = this._api.getIFrame();
const mainApp = frame.contentWindow.document.getElementById('react');

if (!mainApp) {
console.warn('Main application not loaded');

this._navigateToHome(

// $FlowFixMe
{
error: 'Loading error',
type: 'error'
},
this._conference.room,
this._conference.serverURL);

return;
}

this.setState({
isLoading: false
});
Expand Down

0 comments on commit 5cbdc32

Please sign in to comment.