Browse Source

Fixes the gsm bars during ice disconnected

master
hristoterezov 9 years ago
parent
commit
9d170e4c59
2 changed files with 33 additions and 5 deletions
  1. 15
    1
      conference.js
  2. 18
    4
      modules/connectionquality/connectionquality.js

+ 15
- 1
conference.js View File

@@ -25,6 +25,11 @@ const TrackErrors = JitsiMeetJS.errors.track;
25 25
 
26 26
 let room, connection, localAudio, localVideo, roomLocker;
27 27
 
28
+/**
29
+ * Indicates whether the connection is interrupted or not.
30
+ */
31
+let connectionIsInterrupted = false;
32
+
28 33
 import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo";
29 34
 
30 35
 /**
@@ -1076,6 +1081,15 @@ export default {
1076 1081
             });
1077 1082
         }
1078 1083
 
1084
+        room.on(ConferenceEvents.CONNECTION_INTERRUPTED, () => {
1085
+            connectionIsInterrupted = true;
1086
+            ConnectionQuality.updateLocalConnectionQuality(0);
1087
+        });
1088
+
1089
+        room.on(ConferenceEvents.CONNECTION_RESTORED, () => {
1090
+            connectionIsInterrupted = false;
1091
+        });
1092
+
1079 1093
         room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, (id, displayName) => {
1080 1094
             APP.API.notifyDisplayNameChanged(id, displayName);
1081 1095
             APP.UI.changeDisplayName(id, displayName);
@@ -1131,7 +1145,7 @@ export default {
1131 1145
         }
1132 1146
 
1133 1147
         room.on(ConferenceEvents.CONNECTION_STATS, function (stats) {
1134
-            ConnectionQuality.updateLocalStats(stats);
1148
+            ConnectionQuality.updateLocalStats(stats, connectionIsInterrupted);
1135 1149
         });
1136 1150
 
1137 1151
         ConnectionQuality.addListener(CQEvents.LOCALSTATS_UPDATED,

+ 18
- 4
modules/connectionquality/connectionquality.js View File

@@ -41,12 +41,26 @@ export default {
41 41
     /**
42 42
      * Updates the local statistics
43 43
      * @param data new statistics
44
+     * @param dontUpdateLocalConnectionQuality {boolean} if true -
45
+     * localConnectionQuality wont be recalculated.
44 46
      */
45
-    updateLocalStats: function (data) {
47
+    updateLocalStats: function (data, dontUpdateLocalConnectionQuality) {
46 48
         stats = data;
47
-        var newVal = 100 - stats.packetLoss.total;
48
-        localConnectionQuality =
49
-            calculateQuality(newVal, localConnectionQuality);
49
+        if(!dontUpdateLocalConnectionQuality) {
50
+            var newVal = 100 - stats.packetLoss.total;
51
+            localConnectionQuality =
52
+                calculateQuality(newVal, localConnectionQuality);
53
+        }
54
+        eventEmitter.emit(CQEvents.LOCALSTATS_UPDATED, localConnectionQuality,
55
+            stats);
56
+    },
57
+
58
+    /**
59
+     * Updates only the localConnectionQuality value
60
+     * @param values {int} the new value. should be from 0 - 100.
61
+     */
62
+    updateLocalConnectionQuality: function (value) {
63
+        localConnectionQuality = value;
50 64
         eventEmitter.emit(CQEvents.LOCALSTATS_UPDATED, localConnectionQuality,
51 65
             stats);
52 66
     },

Loading…
Cancel
Save