Browse Source

Handles multiple IPs displayed in connection popover.

master
hristoterezov 10 years ago
parent
commit
13e43e2b25
2 changed files with 56 additions and 14 deletions
  1. 1
    1
      index.html
  2. 55
    13
      videolayout.js

+ 1
- 1
index.html View File

@@ -47,7 +47,7 @@
47 47
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
48 48
     <script src="rtp_sts.js?v=3"></script><!-- RTP stats processing -->
49 49
     <script src="local_sts.js?v=2"></script><!-- Local stats processing -->
50
-    <script src="videolayout.js?v=17"></script><!-- video ui -->
50
+    <script src="videolayout.js?v=18"></script><!-- video ui -->
51 51
     <script src="connectionquality.js?v=1"></script>
52 52
     <script src="toolbar.js?v=6"></script><!-- toolbar ui -->
53 53
     <script src="toolbar_toggler.js?v=2"></script>

+ 55
- 13
videolayout.js View File

@@ -1531,6 +1531,24 @@ var VideoLayout = (function (my) {
1531 1531
         this.updatePopoverData();
1532 1532
     };
1533 1533
 
1534
+    ConnectionIndicator.getIP = function(value)
1535
+    {
1536
+        return value.substring(0, value.indexOf(":"));
1537
+    };
1538
+
1539
+    ConnectionIndicator.getPort = function(value)
1540
+    {
1541
+        return value.substring(value.indexOf(":") + 1, value.length);
1542
+    };
1543
+
1544
+    ConnectionIndicator.getStringFromArray = function (array) {
1545
+        var res = "";
1546
+        for(var i = 0; i < array.length; i++)
1547
+        {
1548
+            res += (i == 0? "" : ", ") + array[i];
1549
+        }
1550
+        return res;
1551
+    }
1534 1552
     /**
1535 1553
      * Generates the html content.
1536 1554
      * @returns {string} the html content.
@@ -1616,10 +1634,40 @@ var VideoLayout = (function (my) {
1616 1634
             }
1617 1635
             else
1618 1636
             {
1619
-                var localTransport = "<tr><td><span class='jitsipopover_blue'>Local address: </span></td><td> " +
1620
-                    this.transport[0].localip.substring(0,this.transport[0].localip.indexOf(":")) + "</td></tr>"
1621
-                transport = "<tr><td><span class='jitsipopover_blue'>Remote address:</span></td><td> " +
1622
-                    this.transport[0].ip.substring(0,this.transport[0].ip.indexOf(":")) + "</td></tr>";
1637
+                var data = {remoteIP: [], localIP:[], remotePort:[], localPort:[]};
1638
+                for(var i = 0; i < this.transport.length; i++)
1639
+                {
1640
+                    var ip =  ConnectionIndicator.getIP(this.transport[i].ip);
1641
+                    var port = ConnectionIndicator.getPort(this.transport[i].ip);
1642
+                    var localIP = ConnectionIndicator.getIP(this.transport[i].localip);
1643
+                    var localPort = ConnectionIndicator.getPort(this.transport[i].localip);
1644
+                    if(data.remoteIP.indexOf(ip) == -1)
1645
+                    {
1646
+                       data.remoteIP.push(ip);
1647
+                    }
1648
+
1649
+                    if(data.remotePort.indexOf(port) == -1)
1650
+                    {
1651
+                        data.remotePort.push(port);
1652
+                    }
1653
+
1654
+                    if(data.localIP.indexOf(localIP) == -1)
1655
+                    {
1656
+                        data.localIP.push(localIP);
1657
+                    }
1658
+
1659
+                    if(data.localPort.indexOf(localPort) == -1)
1660
+                    {
1661
+                        data.localPort.push(localPort);
1662
+                    }
1663
+
1664
+                }
1665
+                var localTransport = "<tr><td><span class='jitsipopover_blue'>Local address" +
1666
+                    (data.localIP.length > 1? "es" : "") + ": </span></td><td> " +
1667
+                     ConnectionIndicator.getStringFromArray(data.localIP) + "</td></tr>";
1668
+                transport = "<tr><td><span class='jitsipopover_blue'>Remote address"+
1669
+                    (data.remoteIP.length > 1? "es" : "") + ":</span></td><td> " +
1670
+                    ConnectionIndicator.getStringFromArray(data.remoteIP) + "</td></tr>";
1623 1671
                 if(this.transport.length > 1)
1624 1672
                 {
1625 1673
                     transport += "<tr><td><span class='jitsipopover_blue'>Remote ports:</span></td><td>";
@@ -1630,15 +1678,9 @@ var VideoLayout = (function (my) {
1630 1678
                     transport += "<tr><td><span class='jitsipopover_blue'>Remote port:</span></td><td>";
1631 1679
                     localTransport += "<tr><td><span class='jitsipopover_blue'>Local port:</span></td><td>";
1632 1680
                 }
1633
-                for(var i = 0; i < this.transport.length; i++)
1634
-                {
1635
-                    transport += ((i !== 0)? ", " : "") +
1636
-                        this.transport[i].ip.substring(this.transport[i].ip.indexOf(":")+1,
1637
-                                this.transport[i].ip.length);
1638
-                    localTransport += ((i !== 0)? ", " : "") +
1639
-                        this.transport[i].localip.substring(this.transport[i].localip.indexOf(":")+1,
1640
-                            this.transport[i].localip.length);
1641
-                }
1681
+
1682
+                transport += ConnectionIndicator.getStringFromArray(data.remotePort);
1683
+                localTransport += ConnectionIndicator.getStringFromArray(data.localPort);
1642 1684
                 transport += "</td></tr>";
1643 1685
                 transport += localTransport + "</td></tr>";
1644 1686
                 transport +="<tr><td><span class='jitsipopover_blue'>Transport:</span></td><td>" + this.transport[0].type + "</td></tr>";

Loading…
Cancel
Save