Browse Source

callstats: set the namespace based on the configured host

As opoosed to using window.location, which is not available on all platforms,
notably on mobile.
dev1
Saúl Ibarra Corretgé 8 years ago
parent
commit
e00f2da72f
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      JitsiConference.js

+ 10
- 1
JitsiConference.js View File

@@ -244,11 +244,20 @@ JitsiConference.prototype._init = function(options = {}) {
244 244
     this.participantConnectionStatus.init();
245 245
 
246 246
     if (!this.statistics) {
247
+        // XXX The property location on the global variable window is not
248
+        // defined in all execution environments (e.g. react-native). While
249
+        // jitsi-meet may polyfill it when executing on react-native, it is
250
+        // better for the cross-platform support to not require window.location
251
+        // especially when there is a worthy alternative (as demonstrated
252
+        // bellow).
253
+        const windowLocation = window.location;
254
+
247 255
         this.statistics = new Statistics(this.xmpp, {
248 256
             callStatsAliasName: this.myUserId(),
249 257
             callStatsConfIDNamespace:
250 258
                 config.callStatsConfIDNamespace
251
-                    || window.location.hostname,
259
+                    || (windowLocation && windowLocation.hostname)
260
+                    || (config.hosts && config.hosts.domain),
252 261
             callStatsCustomScriptUrl: config.callStatsCustomScriptUrl,
253 262
             callStatsID: config.callStatsID,
254 263
             callStatsSecret: config.callStatsSecret,

Loading…
Cancel
Save