diff --git a/raspberry/roberto/views/frontend/templates/index.html b/raspberry/roberto/views/frontend/templates/index.html index 3bed61b..aeb2ba1 100644 --- a/raspberry/roberto/views/frontend/templates/index.html +++ b/raspberry/roberto/views/frontend/templates/index.html @@ -44,6 +44,7 @@ +
@@ -165,6 +166,25 @@ socket.on('data', (data) => { }); }; + +statsInterval = window.setInterval(getConnectionStats, 1000); + +function getConnectionStats() { + webrtcPeerConnection.getStats(null).then(stats => { + var statsOutput = ""; + + stats.forEach(report => { + if (report.type === "inbound-rtp" && report.kind === "video") { + Object.keys(report).forEach(statName => { + statsOutput += `${statName}: ${report[statName]}
\n`; + }); + } + }); + + document.querySelector(".stats-box").innerHTML = statsOutput; + }); +} +