Fixes focus restore in the case of only 2 participants and one of them reloads.

This commit is contained in:
yanas 2014-05-12 11:56:33 +02:00
parent f44cf1e87f
commit 68ff87d0ab
1 changed files with 7 additions and 1 deletions

8
app.js
View File

@ -38,6 +38,8 @@ var getVideoPosition;
var preMuted = false; var preMuted = false;
var sessionTerminated = false;
function init() { function init() {
RTC = setupRTC(); RTC = setupRTC();
if (RTC === null) { if (RTC === null) {
@ -495,6 +497,7 @@ $(document).bind('callactive.jingle', function (event, videoelem, sid) {
$(document).bind('callterminated.jingle', function (event, sid, jid, reason) { $(document).bind('callterminated.jingle', function (event, sid, jid, reason) {
// Leave the room if my call has been remotely terminated. // Leave the room if my call has been remotely terminated.
if (connection.emuc.joined && focus == null && reason === 'kick') { if (connection.emuc.joined && focus == null && reason === 'kick') {
sessionTerminated = true;
connection.emuc.doLeave(); connection.emuc.doLeave();
openMessageDialog( "Session Terminated", openMessageDialog( "Session Terminated",
"Ouch! You have been kicked out of the meet!"); "Ouch! You have been kicked out of the meet!");
@ -607,9 +610,12 @@ $(document).bind('left.muc', function (event, jid) {
connection.jingle.terminateByJid(jid); connection.jingle.terminateByJid(jid);
if (focus == null if (focus == null
// I shouldn't be the one that left to enter here.
&& jid !== connection.emuc.myroomjid && jid !== connection.emuc.myroomjid
&& connection.emuc.myroomjid === connection.emuc.list_members[0] && connection.emuc.myroomjid === connection.emuc.list_members[0]
&& connection.emuc.list_members.length > 1) { // If our session has been terminated for some reason
// (kicked, hangup), don't try to become the focus
&& !sessionTerminated) {
console.log('welcome to our new focus... myself'); console.log('welcome to our new focus... myself');
focus = new ColibriFocus(connection, config.hosts.bridge); focus = new ColibriFocus(connection, config.hosts.bridge);
if (Object.keys(connection.emuc.members).length > 0) { if (Object.keys(connection.emuc.members).length > 0) {