瀏覽代碼

Fixes disapearing videos after a focus change. Fixes disapearing mute menu after a focus change.

master
yanas 11 年之前
父節點
當前提交
96b7a3d3e1
共有 1 個檔案被更改,包括 12 行新增8 行删除
  1. 12
    8
      app.js

+ 12
- 8
app.js 查看文件

276
     var remotes = document.getElementById('remoteVideos');
276
     var remotes = document.getElementById('remoteVideos');
277
 
277
 
278
     if (data.peerjid) {
278
     if (data.peerjid) {
279
+        ensurePeerContainerExists(data.peerjid);
279
         container  = document.getElementById(
280
         container  = document.getElementById(
280
                 'participant_' + Strophe.getResourceFromJid(data.peerjid));
281
                 'participant_' + Strophe.getResourceFromJid(data.peerjid));
281
-        if (!container) {
282
-            console.error('no container for', data.peerjid);
283
-        } else {
284
-            //console.log('found container for', data.peerjid);
285
-        }
286
     } else {
282
     } else {
287
         if (data.stream.id !== 'mixedmslabel') {
283
         if (data.stream.id !== 'mixedmslabel') {
288
             console.error('can not associate stream', data.stream.id, 'with a participant');
284
             console.error('can not associate stream', data.stream.id, 'with a participant');
330
         var audioCount = $('#' + container.id + '>audio').length;
326
         var audioCount = $('#' + container.id + '>audio').length;
331
         var videoCount = $('#' + container.id + '>video').length;
327
         var videoCount = $('#' + container.id + '>video').length;
332
         if (!audioCount && !videoCount) {
328
         if (!audioCount && !videoCount) {
333
-            console.log("Remove whole user");
329
+            console.log("Remove whole user", container.id);
334
             // Remove whole container
330
             // Remove whole container
335
             container.remove();
331
             container.remove();
336
             Util.playSoundNotification('userLeft');
332
             Util.playSoundNotification('userLeft');
1526
     }
1522
     }
1527
     else if (Object.keys(connection.jingle.sessions).length > 0) {
1523
     else if (Object.keys(connection.jingle.sessions).length > 0) {
1528
         // If we're only a participant the focus will be the only session we have.
1524
         // If we're only a participant the focus will be the only session we have.
1529
-        var session = connection.jingle.sessions[Object.keys(connection.jingle.sessions)[0]];
1530
-        var focusId = 'participant_' + Strophe.getResourceFromJid(session.peerjid);
1525
+        var session
1526
+            = connection.jingle.sessions
1527
+                [Object.keys(connection.jingle.sessions)[0]];
1528
+        var focusId
1529
+            = 'participant_' + Strophe.getResourceFromJid(session.peerjid);
1531
         var focusContainer = document.getElementById(focusId);
1530
         var focusContainer = document.getElementById(focusId);
1532
         if (!focusContainer) {
1531
         if (!focusContainer) {
1533
             console.error("No focus container!");
1532
             console.error("No focus container!");
1554
     var videoSpanId = 'participant_' + peerResource;
1553
     var videoSpanId = 'participant_' + peerResource;
1555
 
1554
 
1556
     if ($('#' + videoSpanId).length > 0) {
1555
     if ($('#' + videoSpanId).length > 0) {
1556
+        // If there's been a focus change, make sure we add focus related
1557
+        // interface!!
1558
+        if (focus && $('#remote_popupmenu_' + peerResource).length <= 0)
1559
+            addRemoteVideoMenu( peerJid,
1560
+                                document.getElementById(videoSpanId));
1557
         return;
1561
         return;
1558
     }
1562
     }
1559
 
1563
 

Loading…
取消
儲存