瀏覽代碼

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

j8
yanas 11 年之前
父節點
當前提交
68ff87d0ab
共有 1 個檔案被更改,包括 7 行新增1 行删除
  1. 7
    1
      app.js

+ 7
- 1
app.js 查看文件

38
 
38
 
39
 var preMuted = false;
39
 var preMuted = false;
40
 
40
 
41
+var sessionTerminated = false;
42
+
41
 function init() {
43
 function init() {
42
     RTC = setupRTC();
44
     RTC = setupRTC();
43
     if (RTC === null) {
45
     if (RTC === null) {
495
 $(document).bind('callterminated.jingle', function (event, sid, jid, reason) {
497
 $(document).bind('callterminated.jingle', function (event, sid, jid, reason) {
496
     // Leave the room if my call has been remotely terminated.
498
     // Leave the room if my call has been remotely terminated.
497
     if (connection.emuc.joined && focus == null && reason === 'kick') {
499
     if (connection.emuc.joined && focus == null && reason === 'kick') {
500
+        sessionTerminated = true;
498
         connection.emuc.doLeave();
501
         connection.emuc.doLeave();
499
         openMessageDialog(  "Session Terminated",
502
         openMessageDialog(  "Session Terminated",
500
                             "Ouch! You have been kicked out of the meet!");
503
                             "Ouch! You have been kicked out of the meet!");
607
     connection.jingle.terminateByJid(jid);
610
     connection.jingle.terminateByJid(jid);
608
 
611
 
609
     if (focus == null
612
     if (focus == null
613
+            // I shouldn't be the one that left to enter here.
610
             && jid !== connection.emuc.myroomjid
614
             && jid !== connection.emuc.myroomjid
611
             && connection.emuc.myroomjid === connection.emuc.list_members[0]
615
             && connection.emuc.myroomjid === connection.emuc.list_members[0]
612
-            && connection.emuc.list_members.length > 1) {
616
+            // If our session has been terminated for some reason
617
+            // (kicked, hangup), don't try to become the focus
618
+            && !sessionTerminated) {
613
         console.log('welcome to our new focus... myself');
619
         console.log('welcome to our new focus... myself');
614
         focus = new ColibriFocus(connection, config.hosts.bridge);
620
         focus = new ColibriFocus(connection, config.hosts.bridge);
615
         if (Object.keys(connection.emuc.members).length > 0) {
621
         if (Object.keys(connection.emuc.members).length > 0) {

Loading…
取消
儲存