Stream ID was broken in the current viewers stats

This commit is contained in:
Yohann D'ANELLO 2020-10-13 17:43:53 +02:00
parent a2efa1126f
commit e154fe1a1e
2 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
// Refresh viewer count by pulling metric from server
function refreshViewersCounter(period) {
function refreshViewersCounter(streamID, period) {
// Distinguish oneDomainPerStream mode
fetch("/_stats/" + (location.pathname === "/" ? location.host : location.pathname.substring(1)))
fetch("/_stats/" + streamID)
.then(response => response.json())
.then((data) => document.getElementById("connected-people").innerText = data.ConnectedViewers)
.catch(console.log)

View File

@ -50,7 +50,7 @@
// Wait a bit before pulling viewers counter for the first time
setTimeout(() => {
refreshViewersCounter({{.Cfg.ViewersCounterRefreshPeriod}})
refreshViewersCounter({{.Path}}, {{.Cfg.ViewersCounterRefreshPeriod}})
}, 1000)
</script>
{{end}}