Browse Source

feat: moves isConnectionInterrupted to lib-jitsi-meet.

dev1
Boris Grozev 8 years ago
parent
commit
3da8825543
2 changed files with 34 additions and 13 deletions
  1. 16
    0
      JitsiConference.js
  2. 18
    13
      JitsiConferenceEventManager.js

+ 16
- 0
JitsiConference.js View File

@@ -65,8 +65,20 @@ function JitsiConference(options) {
65 65
     // We need to know if the potential issue happened before or after
66 66
     // the restart.
67 67
     this.wasStopped = false;
68
+
69
+    /**
70
+     * The object which monitors local and remote connection statistics (e.g.
71
+     * sending bitrate) and calculates a number which represents the connection
72
+     * quality.
73
+     */
68 74
     this.connectionQuality
69 75
         = new ConnectionQuality(this, this.eventEmitter, options);
76
+
77
+    /**
78
+     * Indicates whether the connection is interrupted or not.
79
+     */
80
+    this.connectionIsInterrupted = false;
81
+
70 82
 }
71 83
 
72 84
 /**
@@ -1250,4 +1262,8 @@ JitsiConference.prototype.broadcastEndpointMessage = function (payload) {
1250 1262
     this.sendEndpointMessage("", payload);
1251 1263
 };
1252 1264
 
1265
+JitsiConference.prototype.isConnectionInterrupted = function () {
1266
+    return this.connectionIsInterrupted;
1267
+};
1268
+
1253 1269
 module.exports = JitsiConference;

+ 18
- 13
JitsiConferenceEventManager.js View File

@@ -99,19 +99,22 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
99 99
         JitsiConferenceEvents.CONFERENCE_JOINED);
100 100
     // send some analytics events
101 101
     chatRoom.addListener(XMPPEvents.MUC_JOINED,
102
-        function ()
103
-        {
104
-            for (var ckey in chatRoom.connectionTimes){
105
-                var cvalue = chatRoom.connectionTimes[ckey];
106
-                Statistics.analytics.sendEvent('conference.' + ckey,
107
-                    {value: cvalue});
102
+        () => {
103
+            let key, value;
104
+
105
+            this.conference.connectionIsInterrupted = false;
106
+
107
+            for (key in chatRoom.connectionTimes){
108
+                value = chatRoom.connectionTimes[key];
109
+                Statistics.analytics.sendEvent('conference.' + key,
110
+                    {value: value});
108 111
             }
109
-            for (var xkey in chatRoom.xmpp.connectionTimes){
110
-                var xvalue = chatRoom.xmpp.connectionTimes[xkey];
111
-                Statistics.analytics.sendEvent('xmpp.' + xkey,
112
-                    {value: xvalue});
112
+            for (key in chatRoom.xmpp.connectionTimes){
113
+                value = chatRoom.xmpp.connectionTimes[key];
114
+                Statistics.analytics.sendEvent('xmpp.' + key,
115
+                    {value: value});
113 116
             }
114
-        });
117
+    });
115 118
 
116 119
     this.chatRoomForwarder.forward(XMPPEvents.ROOM_JOIN_ERROR,
117 120
         JitsiConferenceEvents.CONFERENCE_FAILED,
@@ -195,8 +198,9 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
195 198
     this.chatRoomForwarder.forward(XMPPEvents.CONNECTION_INTERRUPTED,
196 199
         JitsiConferenceEvents.CONNECTION_INTERRUPTED);
197 200
     chatRoom.addListener(XMPPEvents.CONNECTION_INTERRUPTED,
198
-        function () {
201
+        () => {
199 202
             Statistics.sendEventToAll('connection.interrupted');
203
+            this.conference.connectionIsInterrupted = true;
200 204
         });
201 205
 
202 206
     this.chatRoomForwarder.forward(XMPPEvents.RECORDER_STATE_CHANGED,
@@ -208,8 +212,9 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
208 212
     this.chatRoomForwarder.forward(XMPPEvents.CONNECTION_RESTORED,
209 213
         JitsiConferenceEvents.CONNECTION_RESTORED);
210 214
     chatRoom.addListener(XMPPEvents.CONNECTION_RESTORED,
211
-        function () {
215
+        () => {
212 216
             Statistics.sendEventToAll('connection.restored');
217
+            this.conference.connectionIsInterrupted = false;
213 218
         });
214 219
 
215 220
     this.chatRoomForwarder.forward(XMPPEvents.CONFERENCE_SETUP_FAILED,

Loading…
Cancel
Save