1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-23 12:02:20 +00:00
ghostream/web/static/js/viewersCounter.js

13 lines
444 B
JavaScript

// Refresh viewer count by pulling metric from server
function refreshViewersCounter(streamID, period) {
// Distinguish oneDomainPerStream mode
fetch("/_stats/" + streamID)
.then(response => response.json())
.then((data) => document.getElementById("connected-people").innerText = data.ConnectedViewers)
.catch(console.log)
setTimeout(() => {
refreshViewersCounter(streamID, period)
}, period)
}