From a148cd41a4cb37a1dacf64f0e45130d241269654 Mon Sep 17 00:00:00 2001 From: damencho Date: Mon, 8 Jul 2019 11:54:54 +0100 Subject: [PATCH] Fixes loading wifi-stats when used from jitsi-meet electron utils. --- conference.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/conference.js b/conference.js index 9d9cbd526..12f134084 100644 --- a/conference.js +++ b/conference.js @@ -1247,11 +1247,26 @@ export default { } options.applicationName = interfaceConfig.APP_NAME; - options.getWiFiStatsMethod = getJitsiMeetGlobalNS().getWiFiStats; + options.getWiFiStatsMethod = this._getWiFiStatsMethod; return options; }, + /** + * Returns the result of getWiFiStats from the global NS or does nothing + * (returns empty result). + * Fixes a concurrency problem where we need to pass a function when creating + * JitsiConference, but that method is added to the context later. + * + * @returns {Promise} + * @private + */ + _getWiFiStatsMethod() { + const gloabalNS = getJitsiMeetGlobalNS(); + + return gloabalNS.getWiFiStats ? gloabalNS.getWiFiStats() : Promise.resolve('{}'); + }, + /** * Start using provided video stream. * Stops previous video stream.