listen to CONNECTION_INTERRUPTED and CONNECTION_RESTORED events
This commit is contained in:
parent
c21c9ce1b8
commit
4152106a06
28
app.js
28
app.js
|
@ -119,7 +119,7 @@ function connect() {
|
|||
connection.connect();
|
||||
}).catch(function (errType, msg) {
|
||||
// TODO handle OTHER_ERROR only
|
||||
UI.notifyConnectionFailed(msg);
|
||||
APP.UI.notifyConnectionFailed(msg);
|
||||
|
||||
// rethrow
|
||||
throw new Error(errType);
|
||||
|
@ -140,7 +140,7 @@ function initConference(connection, roomName) {
|
|||
if (config.muteLocalVideoIfNotInLastN) {
|
||||
// TODO mute or unmute if required
|
||||
// mark video on UI
|
||||
// UI.markVideoMuted(true/false);
|
||||
// APP.UI.markVideoMuted(true/false);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -160,7 +160,7 @@ function initConference(connection, roomName) {
|
|||
room.on(
|
||||
ConferenceEvents.DISPLAY_NAME_CHANGED,
|
||||
function (id, displayName) {
|
||||
UI.changeDisplayName(id, displayName);
|
||||
APP.UI.changeDisplayName(id, displayName);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -168,14 +168,14 @@ function initConference(connection, roomName) {
|
|||
ConferenceEvents.USER_JOINED,
|
||||
function (id) {
|
||||
// FIXME ????
|
||||
UI.addUser();
|
||||
APP.UI.addUser();
|
||||
}
|
||||
);
|
||||
|
||||
room.on(
|
||||
ConferenceEvents.USER_LEFT,
|
||||
function (id) {
|
||||
UI.removeUser(id);
|
||||
APP.UI.removeUser(id);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -189,7 +189,21 @@ function initConference(connection, roomName) {
|
|||
room.on(
|
||||
ConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED,
|
||||
function (id, lvl) {
|
||||
UI.setAudioLevel(id, lvl);
|
||||
APP.UI.setAudioLevel(id, lvl);
|
||||
}
|
||||
);
|
||||
|
||||
room.on(
|
||||
ConferenceEvents.CONNECTION_INTERRUPTED,
|
||||
function () {
|
||||
APP.UI.markVideoInterrupted(true);
|
||||
}
|
||||
);
|
||||
|
||||
room.on(
|
||||
ConferenceEvents.CONNECTION_RESTORED,
|
||||
function () {
|
||||
APP.UI.markVideoInterrupted(false);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -219,7 +233,7 @@ function initConference(connection, roomName) {
|
|||
|
||||
function init() {
|
||||
connect().then(function (connection) {
|
||||
return initConference(connection, UI.generateRoomName());
|
||||
return initConference(connection, APP.UI.generateRoomName());
|
||||
}).then(function (conference) {
|
||||
APP.conference = conference;
|
||||
|
||||
|
|
|
@ -320,8 +320,8 @@ function chatSetSubject(text) {
|
|||
return Chat.chatSetSubject(text);
|
||||
}
|
||||
|
||||
function updateChatConversation(from, displayName, message, myjid, stamp) {
|
||||
return Chat.updateChatConversation(from, displayName, message, myjid, stamp);
|
||||
function updateChatConversation(from, displayName, message, stamp) {
|
||||
return Chat.updateChatConversation(from, displayName, message, stamp);
|
||||
}
|
||||
|
||||
function initEtherpad(name) {
|
||||
|
@ -689,4 +689,12 @@ UI.showAuthenticateButton = function (show) {
|
|||
Toolbar.showAuthenticateButton(show);
|
||||
};
|
||||
|
||||
UI.markVideoInterrupted = function (interrupted) {
|
||||
if (interrupted) {
|
||||
VideoLayout.onVideoInterrupted();
|
||||
} else {
|
||||
VideoLayout.onVideoRestored();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = UI;
|
||||
|
|
|
@ -228,7 +228,7 @@ var Chat = (function (my) {
|
|||
* Appends the given message to the chat conversation.
|
||||
*/
|
||||
my.updateChatConversation =
|
||||
function (from, displayName, message, myjid, stamp) {
|
||||
function (from, displayName, message, stamp) {
|
||||
var divClassName = '';
|
||||
|
||||
if (APP.xmpp.myJid() === from) {
|
||||
|
|
Loading…
Reference in New Issue