Переглянути джерело

listen to CONNECTION_INTERRUPTED and CONNECTION_RESTORED events

master
isymchych 10 роки тому
джерело
коміт
4152106a06
3 змінених файлів з 32 додано та 10 видалено
  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 Переглянути файл

119
         connection.connect();
119
         connection.connect();
120
     }).catch(function (errType, msg) {
120
     }).catch(function (errType, msg) {
121
         // TODO handle OTHER_ERROR only
121
         // TODO handle OTHER_ERROR only
122
-        UI.notifyConnectionFailed(msg);
122
+        APP.UI.notifyConnectionFailed(msg);
123
 
123
 
124
         // rethrow
124
         // rethrow
125
         throw new Error(errType);
125
         throw new Error(errType);
140
         if (config.muteLocalVideoIfNotInLastN) {
140
         if (config.muteLocalVideoIfNotInLastN) {
141
             // TODO mute or unmute if required
141
             // TODO mute or unmute if required
142
             // mark video on UI
142
             // mark video on UI
143
-            // UI.markVideoMuted(true/false);
143
+            // APP.UI.markVideoMuted(true/false);
144
         }
144
         }
145
     });
145
     });
146
 
146
 
160
     room.on(
160
     room.on(
161
         ConferenceEvents.DISPLAY_NAME_CHANGED,
161
         ConferenceEvents.DISPLAY_NAME_CHANGED,
162
         function (id, displayName) {
162
         function (id, displayName) {
163
-            UI.changeDisplayName(id, displayName);
163
+            APP.UI.changeDisplayName(id, displayName);
164
         }
164
         }
165
     );
165
     );
166
 
166
 
168
         ConferenceEvents.USER_JOINED,
168
         ConferenceEvents.USER_JOINED,
169
         function (id) {
169
         function (id) {
170
             // FIXME ????
170
             // FIXME ????
171
-            UI.addUser();
171
+            APP.UI.addUser();
172
         }
172
         }
173
     );
173
     );
174
 
174
 
175
     room.on(
175
     room.on(
176
         ConferenceEvents.USER_LEFT,
176
         ConferenceEvents.USER_LEFT,
177
         function (id) {
177
         function (id) {
178
-            UI.removeUser(id);
178
+            APP.UI.removeUser(id);
179
         }
179
         }
180
     );
180
     );
181
 
181
 
189
     room.on(
189
     room.on(
190
         ConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED,
190
         ConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED,
191
         function (id, lvl) {
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
 
233
 
220
 function init() {
234
 function init() {
221
     connect().then(function (connection) {
235
     connect().then(function (connection) {
222
-        return initConference(connection, UI.generateRoomName());
236
+        return initConference(connection, APP.UI.generateRoomName());
223
     }).then(function (conference) {
237
     }).then(function (conference) {
224
         APP.conference = conference;
238
         APP.conference = conference;
225
 
239
 

+ 10
- 2
modules/UI/UI.js Переглянути файл

320
     return Chat.chatSetSubject(text);
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
 function initEtherpad(name) {
327
 function initEtherpad(name) {
689
     Toolbar.showAuthenticateButton(show);
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
 module.exports = UI;
700
 module.exports = UI;

+ 1
- 1
modules/UI/side_pannels/chat/Chat.js Переглянути файл

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

Завантаження…
Відмінити
Зберегти