Fixes conference recreation issues when focus leaves.
This commit is contained in:
parent
cc03ace1b4
commit
39895ed137
53
app.js
53
app.js
|
@ -262,11 +262,7 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
|
||||||
container = document.getElementById(
|
container = document.getElementById(
|
||||||
'participant_' + Strophe.getResourceFromJid(data.peerjid));
|
'participant_' + Strophe.getResourceFromJid(data.peerjid));
|
||||||
if (!container) {
|
if (!container) {
|
||||||
console.warn('no container for', data.peerjid);
|
console.error('no container for', data.peerjid);
|
||||||
// create for now...
|
|
||||||
// FIXME: should be removed
|
|
||||||
container = addRemoteVideoContainer(
|
|
||||||
'participant_' + Strophe.getResourceFromJid(data.peerjid));
|
|
||||||
} else {
|
} else {
|
||||||
//console.log('found container for', data.peerjid);
|
//console.log('found container for', data.peerjid);
|
||||||
}
|
}
|
||||||
|
@ -575,17 +571,8 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {
|
||||||
console.log('entered', jid, info);
|
console.log('entered', jid, info);
|
||||||
console.log('is focus?' + focus ? 'true' : 'false');
|
console.log('is focus?' + focus ? 'true' : 'false');
|
||||||
|
|
||||||
var videoSpanId = 'participant_' + Strophe.getResourceFromJid(jid);
|
// Add Peer's container
|
||||||
var container = addRemoteVideoContainer(videoSpanId);
|
ensurePeerContainerExists(jid);
|
||||||
|
|
||||||
if (info.displayName)
|
|
||||||
showDisplayName(videoSpanId, info.displayName);
|
|
||||||
|
|
||||||
var nickfield = document.createElement('span');
|
|
||||||
nickfield.className = "nick";
|
|
||||||
nickfield.appendChild(document.createTextNode(Strophe.getResourceFromJid(jid)));
|
|
||||||
container.appendChild(nickfield);
|
|
||||||
resizeThumbnails();
|
|
||||||
|
|
||||||
if (focus !== null) {
|
if (focus !== null) {
|
||||||
// FIXME: this should prepare the video
|
// FIXME: this should prepare the video
|
||||||
|
@ -600,12 +587,6 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {
|
||||||
else if (sharedKey) {
|
else if (sharedKey) {
|
||||||
updateLockButton();
|
updateLockButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(pres).find('>media[xmlns="http://estos.de/ns/mjs"]>source').each(function (idx, ssrc) {
|
|
||||||
//console.log(jid, 'assoc ssrc', ssrc.getAttribute('type'), ssrc.getAttribute('ssrc'));
|
|
||||||
// Fixme: direction and video types are unhandled here(maybe something more)
|
|
||||||
ssrc2jid[ssrc.getAttribute('ssrc')] = jid;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).bind('left.muc', function (event, jid) {
|
$(document).bind('left.muc', function (event, jid) {
|
||||||
|
@ -674,11 +655,13 @@ $(document).bind('presence.muc', function (event, jid, info, pres) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (info.displayName) {
|
if (info.displayName) {
|
||||||
if (jid === connection.emuc.myroomjid)
|
if (jid === connection.emuc.myroomjid) {
|
||||||
showDisplayName('localVideoContainer', info.displayName + ' (me)');
|
showDisplayName('localVideoContainer', info.displayName + ' (me)');
|
||||||
else
|
} else {
|
||||||
|
ensurePeerContainerExists(jid);
|
||||||
showDisplayName('participant_' + Strophe.getResourceFromJid(jid), info.displayName);
|
showDisplayName('participant_' + Strophe.getResourceFromJid(jid), info.displayName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).bind('passwordrequired.muc', function (event, jid) {
|
$(document).bind('passwordrequired.muc', function (event, jid) {
|
||||||
|
@ -1389,6 +1372,28 @@ function showFocusIndicator() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if container for participant identified by given peerJid exists in the document and creates it eventually.
|
||||||
|
* @param peerJid peer Jid to check.
|
||||||
|
*/
|
||||||
|
function ensurePeerContainerExists(peerJid){
|
||||||
|
|
||||||
|
var peerResource = Strophe.getResourceFromJid(peerJid);
|
||||||
|
var videoSpanId = 'participant_' + peerResource;
|
||||||
|
|
||||||
|
if($('#'+videoSpanId).length > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var container = addRemoteVideoContainer(videoSpanId);
|
||||||
|
|
||||||
|
var nickfield = document.createElement('span');
|
||||||
|
nickfield.className = "nick";
|
||||||
|
nickfield.appendChild(document.createTextNode(peerResource));
|
||||||
|
container.appendChild(nickfield);
|
||||||
|
resizeThumbnails();
|
||||||
|
}
|
||||||
|
|
||||||
function addRemoteVideoContainer(id) {
|
function addRemoteVideoContainer(id) {
|
||||||
var container = document.createElement('span');
|
var container = document.createElement('span');
|
||||||
container.id = id;
|
container.id = id;
|
||||||
|
|
6
muc.js
6
muc.js
|
@ -98,17 +98,15 @@ Strophe.addConnectionPlugin('emuc', {
|
||||||
$(document).trigger('joined.muc', [from, member]);
|
$(document).trigger('joined.muc', [from, member]);
|
||||||
this.list_members.push(from);
|
this.list_members.push(from);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
$(document).trigger('presence.muc', [from, member, pres]);
|
|
||||||
} else if (this.members[from] === undefined) {
|
} else if (this.members[from] === undefined) {
|
||||||
// new participant
|
// new participant
|
||||||
this.members[from] = member;
|
this.members[from] = member;
|
||||||
this.list_members.push(from);
|
this.list_members.push(from);
|
||||||
$(document).trigger('entered.muc', [from, member, pres]);
|
$(document).trigger('entered.muc', [from, member, pres]);
|
||||||
} else {
|
}
|
||||||
|
// Always trigger presence to update bindings
|
||||||
console.log('presence change from', from);
|
console.log('presence change from', from);
|
||||||
$(document).trigger('presence.muc', [from, member, pres]);
|
$(document).trigger('presence.muc', [from, member, pres]);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
onPresenceUnavailable: function (pres) {
|
onPresenceUnavailable: function (pres) {
|
||||||
|
|
Loading…
Reference in New Issue