Explorar el Código

feat: moves isConnectionInterrupted to lib-jitsi-meet.

dev1
Boris Grozev hace 8 años
padre
commit
3da8825543
Se han modificado 2 ficheros con 34 adiciones y 13 borrados
  1. 16
    0
      JitsiConference.js
  2. 18
    13
      JitsiConferenceEventManager.js

+ 16
- 0
JitsiConference.js Ver fichero

65
     // We need to know if the potential issue happened before or after
65
     // We need to know if the potential issue happened before or after
66
     // the restart.
66
     // the restart.
67
     this.wasStopped = false;
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
     this.connectionQuality
74
     this.connectionQuality
69
         = new ConnectionQuality(this, this.eventEmitter, options);
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
     this.sendEndpointMessage("", payload);
1262
     this.sendEndpointMessage("", payload);
1251
 };
1263
 };
1252
 
1264
 
1265
+JitsiConference.prototype.isConnectionInterrupted = function () {
1266
+    return this.connectionIsInterrupted;
1267
+};
1268
+
1253
 module.exports = JitsiConference;
1269
 module.exports = JitsiConference;

+ 18
- 13
JitsiConferenceEventManager.js Ver fichero

99
         JitsiConferenceEvents.CONFERENCE_JOINED);
99
         JitsiConferenceEvents.CONFERENCE_JOINED);
100
     // send some analytics events
100
     // send some analytics events
101
     chatRoom.addListener(XMPPEvents.MUC_JOINED,
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
     this.chatRoomForwarder.forward(XMPPEvents.ROOM_JOIN_ERROR,
119
     this.chatRoomForwarder.forward(XMPPEvents.ROOM_JOIN_ERROR,
117
         JitsiConferenceEvents.CONFERENCE_FAILED,
120
         JitsiConferenceEvents.CONFERENCE_FAILED,
195
     this.chatRoomForwarder.forward(XMPPEvents.CONNECTION_INTERRUPTED,
198
     this.chatRoomForwarder.forward(XMPPEvents.CONNECTION_INTERRUPTED,
196
         JitsiConferenceEvents.CONNECTION_INTERRUPTED);
199
         JitsiConferenceEvents.CONNECTION_INTERRUPTED);
197
     chatRoom.addListener(XMPPEvents.CONNECTION_INTERRUPTED,
200
     chatRoom.addListener(XMPPEvents.CONNECTION_INTERRUPTED,
198
-        function () {
201
+        () => {
199
             Statistics.sendEventToAll('connection.interrupted');
202
             Statistics.sendEventToAll('connection.interrupted');
203
+            this.conference.connectionIsInterrupted = true;
200
         });
204
         });
201
 
205
 
202
     this.chatRoomForwarder.forward(XMPPEvents.RECORDER_STATE_CHANGED,
206
     this.chatRoomForwarder.forward(XMPPEvents.RECORDER_STATE_CHANGED,
208
     this.chatRoomForwarder.forward(XMPPEvents.CONNECTION_RESTORED,
212
     this.chatRoomForwarder.forward(XMPPEvents.CONNECTION_RESTORED,
209
         JitsiConferenceEvents.CONNECTION_RESTORED);
213
         JitsiConferenceEvents.CONNECTION_RESTORED);
210
     chatRoom.addListener(XMPPEvents.CONNECTION_RESTORED,
214
     chatRoom.addListener(XMPPEvents.CONNECTION_RESTORED,
211
-        function () {
215
+        () => {
212
             Statistics.sendEventToAll('connection.restored');
216
             Statistics.sendEventToAll('connection.restored');
217
+            this.conference.connectionIsInterrupted = false;
213
         });
218
         });
214
 
219
 
215
     this.chatRoomForwarder.forward(XMPPEvents.CONFERENCE_SETUP_FAILED,
220
     this.chatRoomForwarder.forward(XMPPEvents.CONFERENCE_SETUP_FAILED,

Loading…
Cancelar
Guardar