mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2025-06-27 23:52:16 +02:00
Get stats by a bad but functionnal way
This commit is contained in:
@ -9,6 +9,7 @@ export class ViewerCounter {
|
||||
constructor(element, streamName) {
|
||||
this.element = element;
|
||||
this.url = "/_stats/" + streamName;
|
||||
this.uid = Math.floor(1e19 * Math.random()).toString(16);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -21,7 +22,7 @@ export class ViewerCounter {
|
||||
}
|
||||
|
||||
refreshViewersCounter() {
|
||||
fetch(this.url)
|
||||
fetch(this.url + "?uid=" + this.uid)
|
||||
.then(response => response.json())
|
||||
.then((data) => this.element.innerText = data.ConnectedViewers)
|
||||
.catch(console.log);
|
||||
|
Reference in New Issue
Block a user