Fixes issues with unloading the page
This commit is contained in:
parent
3168c86f77
commit
95b23f994c
15
app.js
15
app.js
|
@ -210,12 +210,12 @@ function initConference(localTracks, connection) {
|
||||||
|
|
||||||
|
|
||||||
room.on(ConferenceEvents.USER_JOINED, function (id, user) {
|
room.on(ConferenceEvents.USER_JOINED, function (id, user) {
|
||||||
console.error('USER %s connnected', id, user);
|
console.log('USER %s connnected', id, user);
|
||||||
// FIXME email???
|
// FIXME email???
|
||||||
APP.UI.addUser(id, user.getDisplayName());
|
APP.UI.addUser(id, user.getDisplayName());
|
||||||
});
|
});
|
||||||
room.on(ConferenceEvents.USER_LEFT, function (id, user) {
|
room.on(ConferenceEvents.USER_LEFT, function (id, user) {
|
||||||
console.error('USER %s LEFT', id, user);
|
console.log('USER %s LEFT', id, user);
|
||||||
APP.UI.removeUser(id, user.getDisplayName());
|
APP.UI.removeUser(id, user.getDisplayName());
|
||||||
APP.UI.stopPrezi(id);
|
APP.UI.stopPrezi(id);
|
||||||
});
|
});
|
||||||
|
@ -254,7 +254,7 @@ function initConference(localTracks, connection) {
|
||||||
if (track.isLocal()) { // skip local tracks
|
if (track.isLocal()) { // skip local tracks
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.error(
|
console.log(
|
||||||
'REMOTE %s TRACK', track.getType(), track.getParticipantId()
|
'REMOTE %s TRACK', track.getType(), track.getParticipantId()
|
||||||
);
|
);
|
||||||
APP.UI.addRemoteStream(track);
|
APP.UI.addRemoteStream(track);
|
||||||
|
@ -264,7 +264,7 @@ function initConference(localTracks, connection) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error(
|
console.log(
|
||||||
'REMOTE %s TRACK REMOVED', track.getType(), track.getParticipantId()
|
'REMOTE %s TRACK REMOVED', track.getType(), track.getParticipantId()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -556,9 +556,12 @@ function initConference(localTracks, connection) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$(window).bind('beforeunload', function () {
|
const unload = () => {
|
||||||
room.leave();
|
room.leave();
|
||||||
});
|
connection.disconnect();
|
||||||
|
};
|
||||||
|
$(window).bind('beforeunload', unload );
|
||||||
|
$(window).bind('unload', unload );
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
room.on(ConferenceEvents.CONFERENCE_JOINED, handleConferenceJoined);
|
room.on(ConferenceEvents.CONFERENCE_JOINED, handleConferenceJoined);
|
||||||
|
|
|
@ -6289,7 +6289,6 @@ ChatRoom.prototype.createNonAnonymousRoom = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
ChatRoom.prototype.onPresence = function (pres) {
|
ChatRoom.prototype.onPresence = function (pres) {
|
||||||
console.log(pres);
|
|
||||||
var from = pres.getAttribute('from');
|
var from = pres.getAttribute('from');
|
||||||
// Parse roles.
|
// Parse roles.
|
||||||
var member = {};
|
var member = {};
|
||||||
|
@ -6326,7 +6325,6 @@ ChatRoom.prototype.onPresence = function (pres) {
|
||||||
if (displayName && displayName.length > 0) {
|
if (displayName && displayName.length > 0) {
|
||||||
this.eventEmitter.emit(XMPPEvents.DISPLAY_NAME_CHANGED, from, displayName);
|
this.eventEmitter.emit(XMPPEvents.DISPLAY_NAME_CHANGED, from, displayName);
|
||||||
}
|
}
|
||||||
logger.info("Display name: " + displayName, pres);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "userId":
|
case "userId":
|
||||||
|
@ -6345,7 +6343,6 @@ ChatRoom.prototype.onPresence = function (pres) {
|
||||||
var jibri = node;
|
var jibri = node;
|
||||||
break;
|
break;
|
||||||
case "call-control":
|
case "call-control":
|
||||||
console.log(pres);
|
|
||||||
var att = node.attributes;
|
var att = node.attributes;
|
||||||
if(!att)
|
if(!att)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue