From 328ff76016279813a087bc8e65a169b4b5dc7d4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= <s@saghul.net>
Date: Thu, 4 Jun 2020 10:53:32 +0200
Subject: [PATCH] Attach external API listeners early

This avoids any problems caused by the initialization of any of the
extra services initialization failures.
---
 .../conference/components/Conference.js       | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/app/features/conference/components/Conference.js b/app/features/conference/components/Conference.js
index 6e39cad..2639e11 100644
--- a/app/features/conference/components/Conference.js
+++ b/app/features/conference/components/Conference.js
@@ -270,6 +270,16 @@ class Conference extends Component<Props, State> {
             ...urlParameters
         });
 
+
+        this._api.on('suspendDetected', this._onVideoConferenceEnded);
+        this._api.on('readyToClose', this._onVideoConferenceEnded);
+        this._api.on('videoConferenceJoined',
+            (conferenceInfo: Object) => {
+                this.props.dispatch(conferenceJoined(this._conference));
+                this._onVideoConferenceJoined(conferenceInfo);
+            }
+        );
+
         const { RemoteControl,
             setupScreenSharingRender,
             setupAlwaysOnTopRender,
@@ -292,15 +302,6 @@ class Conference extends Component<Props, State> {
 
         setupWiFiStats(iframe);
         setupPowerMonitorRender(this._api);
-
-        this._api.on('suspendDetected', this._onVideoConferenceEnded);
-        this._api.on('readyToClose', this._onVideoConferenceEnded);
-        this._api.on('videoConferenceJoined',
-            (conferenceInfo: Object) => {
-                this.props.dispatch(conferenceJoined(this._conference));
-                this._onVideoConferenceJoined(conferenceInfo);
-            }
-        );
     }
 
     _onVideoConferenceEnded: (*) => void;
-- 
GitLab