Quellcode durchsuchen

listen to CONNECTION_INTERRUPTED and CONNECTION_RESTORED events

master
isymchych vor 10 Jahren
Ursprung
Commit
4152106a06
3 geänderte Dateien mit 32 neuen und 10 gelöschten Zeilen
  1. 21
    7
      app.js
  2. 10
    2
      modules/UI/UI.js
  3. 1
    1
      modules/UI/side_pannels/chat/Chat.js

+ 21
- 7
app.js Datei anzeigen

@@ -119,7 +119,7 @@ function connect() {
119 119
         connection.connect();
120 120
     }).catch(function (errType, msg) {
121 121
         // TODO handle OTHER_ERROR only
122
-        UI.notifyConnectionFailed(msg);
122
+        APP.UI.notifyConnectionFailed(msg);
123 123
 
124 124
         // rethrow
125 125
         throw new Error(errType);
@@ -140,7 +140,7 @@ function initConference(connection, roomName) {
140 140
         if (config.muteLocalVideoIfNotInLastN) {
141 141
             // TODO mute or unmute if required
142 142
             // mark video on UI
143
-            // UI.markVideoMuted(true/false);
143
+            // APP.UI.markVideoMuted(true/false);
144 144
         }
145 145
     });
146 146
 
@@ -160,7 +160,7 @@ function initConference(connection, roomName) {
160 160
     room.on(
161 161
         ConferenceEvents.DISPLAY_NAME_CHANGED,
162 162
         function (id, displayName) {
163
-            UI.changeDisplayName(id, displayName);
163
+            APP.UI.changeDisplayName(id, displayName);
164 164
         }
165 165
     );
166 166
 
@@ -168,14 +168,14 @@ function initConference(connection, roomName) {
168 168
         ConferenceEvents.USER_JOINED,
169 169
         function (id) {
170 170
             // FIXME ????
171
-            UI.addUser();
171
+            APP.UI.addUser();
172 172
         }
173 173
     );
174 174
 
175 175
     room.on(
176 176
         ConferenceEvents.USER_LEFT,
177 177
         function (id) {
178
-            UI.removeUser(id);
178
+            APP.UI.removeUser(id);
179 179
         }
180 180
     );
181 181
 
@@ -189,7 +189,21 @@ function initConference(connection, roomName) {
189 189
     room.on(
190 190
         ConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED,
191 191
         function (id, lvl) {
192
-            UI.setAudioLevel(id, lvl);
192
+            APP.UI.setAudioLevel(id, lvl);
193
+        }
194
+    );
195
+
196
+    room.on(
197
+        ConferenceEvents.CONNECTION_INTERRUPTED,
198
+        function () {
199
+            APP.UI.markVideoInterrupted(true);
200
+        }
201
+    );
202
+
203
+    room.on(
204
+        ConferenceEvents.CONNECTION_RESTORED,
205
+        function () {
206
+            APP.UI.markVideoInterrupted(false);
193 207
         }
194 208
     );
195 209
 
@@ -219,7 +233,7 @@ function initConference(connection, roomName) {
219 233
 
220 234
 function init() {
221 235
     connect().then(function (connection) {
222
-        return initConference(connection, UI.generateRoomName());
236
+        return initConference(connection, APP.UI.generateRoomName());
223 237
     }).then(function (conference) {
224 238
         APP.conference = conference;
225 239
 

+ 10
- 2
modules/UI/UI.js Datei anzeigen

@@ -320,8 +320,8 @@ function chatSetSubject(text) {
320 320
     return Chat.chatSetSubject(text);
321 321
 }
322 322
 
323
-function updateChatConversation(from, displayName, message, myjid, stamp) {
324
-    return Chat.updateChatConversation(from, displayName, message, myjid, stamp);
323
+function updateChatConversation(from, displayName, message, stamp) {
324
+    return Chat.updateChatConversation(from, displayName, message, stamp);
325 325
 }
326 326
 
327 327
 function initEtherpad(name) {
@@ -689,4 +689,12 @@ UI.showAuthenticateButton = function (show) {
689 689
     Toolbar.showAuthenticateButton(show);
690 690
 };
691 691
 
692
+UI.markVideoInterrupted = function (interrupted) {
693
+    if (interrupted) {
694
+        VideoLayout.onVideoInterrupted();
695
+    } else {
696
+        VideoLayout.onVideoRestored();
697
+    }
698
+};
699
+
692 700
 module.exports = UI;

+ 1
- 1
modules/UI/side_pannels/chat/Chat.js Datei anzeigen

@@ -228,7 +228,7 @@ var Chat = (function (my) {
228 228
      * Appends the given message to the chat conversation.
229 229
      */
230 230
     my.updateChatConversation =
231
-        function (from, displayName, message, myjid, stamp) {
231
+        function (from, displayName, message, stamp) {
232 232
         var divClassName = '';
233 233
 
234 234
         if (APP.xmpp.myJid() === from) {

Laden…
Abbrechen
Speichern