Browse Source

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

master
yanas 10 years ago
parent
commit
96b7a3d3e1
1 changed files with 12 additions and 8 deletions
  1. 12
    8
      app.js

+ 12
- 8
app.js View File

@@ -276,13 +276,9 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
276 276
     var remotes = document.getElementById('remoteVideos');
277 277
 
278 278
     if (data.peerjid) {
279
+        ensurePeerContainerExists(data.peerjid);
279 280
         container  = document.getElementById(
280 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 282
     } else {
287 283
         if (data.stream.id !== 'mixedmslabel') {
288 284
             console.error('can not associate stream', data.stream.id, 'with a participant');
@@ -330,7 +326,7 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
330 326
         var audioCount = $('#' + container.id + '>audio').length;
331 327
         var videoCount = $('#' + container.id + '>video').length;
332 328
         if (!audioCount && !videoCount) {
333
-            console.log("Remove whole user");
329
+            console.log("Remove whole user", container.id);
334 330
             // Remove whole container
335 331
             container.remove();
336 332
             Util.playSoundNotification('userLeft');
@@ -1526,8 +1522,11 @@ function showFocusIndicator() {
1526 1522
     }
1527 1523
     else if (Object.keys(connection.jingle.sessions).length > 0) {
1528 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 1530
         var focusContainer = document.getElementById(focusId);
1532 1531
         if (!focusContainer) {
1533 1532
             console.error("No focus container!");
@@ -1554,6 +1553,11 @@ function ensurePeerContainerExists(peerJid) {
1554 1553
     var videoSpanId = 'participant_' + peerResource;
1555 1554
 
1556 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 1561
         return;
1558 1562
     }
1559 1563
 

Loading…
Cancel
Save