2020-09-29 16:44:32 +00:00
|
|
|
// Refresh viewer count by pulling metric from server
|
2020-10-13 15:43:53 +00:00
|
|
|
function refreshViewersCounter(streamID, period) {
|
2020-10-05 20:08:39 +00:00
|
|
|
// Distinguish oneDomainPerStream mode
|
2020-10-13 15:43:53 +00:00
|
|
|
fetch("/_stats/" + streamID)
|
2020-09-30 13:56:24 +00:00
|
|
|
.then(response => response.json())
|
|
|
|
.then((data) => document.getElementById("connected-people").innerText = data.ConnectedViewers)
|
|
|
|
.catch(console.log)
|
2020-09-29 16:25:38 +00:00
|
|
|
|
2020-09-29 16:44:32 +00:00
|
|
|
setTimeout(() => {
|
2020-10-13 15:57:38 +00:00
|
|
|
refreshViewersCounter(streamID, period)
|
2020-09-29 16:44:32 +00:00
|
|
|
}, period)
|
2020-09-29 16:25:38 +00:00
|
|
|
}
|