From 4232481882bc391aedd60e48a4d60ce0c1f64322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramon=20Gabarr=C3=B3?= Date: Wed, 2 May 2018 07:24:03 +0200 Subject: [PATCH 1/2] Add support to multiple application --- public/js/core.js | 15 +++++++++++---- public/js/model.js | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/public/js/core.js b/public/js/core.js index 6e62409..8981847 100644 --- a/public/js/core.js +++ b/public/js/core.js @@ -38,18 +38,25 @@ socket.on('statistics', function(statistics){ var total_bandwidth_in = byteToHuman(statistics.bytes_in[0]); var total_bandwidth_out = byteToHuman(statistics.bytes_out[0]); var up_time = secondsToHuman(statistics.uptime[0]); - var total_viewers = statistics.server[0].application[0].live[0].nclients[0]; var total_request = numeral(statistics.naccepted[0]).format('0.000 a'); - var stream = statistics.server[0].application[0].live[0].stream; - setTotalViewers(numeral(total_viewers).format('0,0')); setBandwidthInPerSec(byteToHuman(bandwidth_in_per_sec)+"/s"); setBandwidthOutPerSec(byteToHuman(bandwidth_out_per_sec)+"/s"); setTotalBandwidthIn(total_bandwidth_in); setTotalBandwidthOut(total_bandwidth_out); setUpTime(up_time); setTotalRequest(total_request); - setLiveStream(stream); + + var table = ""; + var total_viewers = 0; + $.each(statistics.server[0].application, function (index,appx) { + total_viewers += parseInt(appx.live[0].nclients[0]); + var stream = appx.live[0].stream; + table += setLiveStream(stream); + }); + $("#live_stream").html(table); + + setTotalViewers(numeral(total_viewers).format('0,0')); if(monitor_statistics%2 == 0) diff --git a/public/js/model.js b/public/js/model.js index e2725ce..775b117 100644 --- a/public/js/model.js +++ b/public/js/model.js @@ -73,8 +73,8 @@ function setLiveStream(data) }); - $("#live_stream").html(table); - playStreamEvent(); dropStreamEvent(); + return table; + } From ef0ec37e540d77c1fcaf3f081c26ca11600a8dc0 Mon Sep 17 00:00:00 2001 From: calanor Date: Wed, 9 May 2018 18:27:06 +0200 Subject: [PATCH 2/2] Update core.js --- public/js/core.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/js/core.js b/public/js/core.js index 8981847..2eb0cf5 100644 --- a/public/js/core.js +++ b/public/js/core.js @@ -55,6 +55,9 @@ socket.on('statistics', function(statistics){ table += setLiveStream(stream); }); $("#live_stream").html(table); + + playStreamEvent(); + dropStreamEvent(); setTotalViewers(numeral(total_viewers).format('0,0'));