Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Missing file

Gabe Kangas0f214bd16197
diff --git a/web/components/video/viewer-ping.ts b/web/components/video/viewer-ping.ts
new file mode 100644
index 0000000000..5001cc9929
--- /dev/null
+++ b/web/components/video/viewer-ping.ts
@@ -0,0 +1,28 @@
+const URL = '/api/ping';
+const INTERVAL = 4000;
+
+function ping() {
+ try {
+ fetch(URL);
+ } catch (e) {
+ console.error(e);
+ }
+}
+
+class ViewerPing {
+ timer: ReturnType<typeof setInterval>;
+
+ start() {
+ this.stop();
+
+ this.timer = setInterval(() => {
+ ping();
+ }, INTERVAL);
+ }
+
+ stop() {
+ clearInterval(this.timer);
+ }
+}
+
+export default ViewerPing;