From 81bbcb2ad297031f36385359ac9a86e8874e796b Mon Sep 17 00:00:00 2001 From: Mathieu Strypsteen Date: Fri, 27 Oct 2023 15:40:01 +0200 Subject: [PATCH] Add warning on camera feed disconnect --- content/assets/scripts/cammie.js | 21 ++++++++++++++++++++- content/cammie.erb | 9 +++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/content/assets/scripts/cammie.js b/content/assets/scripts/cammie.js index d8442fe5..dc72d481 100644 --- a/content/assets/scripts/cammie.js +++ b/content/assets/scripts/cammie.js @@ -23,8 +23,27 @@ debounce = function(func, wait, initial) { }; }; +var cammieError = false; function cammie_error() { - $("#cammie-feed").attr("src","/assets/images/cammie_down.svg") + cammieError = true; + document.getElementById("cammie-ctrls").remove(); + document.getElementById("cammie-ctrls-2").remove(); + $("#cammie-feed").attr("src","/assets/images/cammie_down.svg") +} +var cammieTimerStarted = false; +function cammie_loaded() { + if (cammieTimerStarted) { + return; + } + showWarning = function() { + if (!cammieError) { + document.getElementById("cammieFeedDisconnected").classList.remove("is-hidden"); + document.getElementById("cammie-ctrls").remove(); + document.getElementById("cammie-ctrls-2").remove(); + } + }; + setTimeout(showWarning, 25000); + cammieTimerStarted = true; } $("#cammie-ctrls").mousemove(debounce(function() { diff --git a/content/cammie.erb b/content/cammie.erb index b75898a5..20ce22f1 100644 --- a/content/cammie.erb +++ b/content/cammie.erb @@ -16,9 +16,14 @@ socket.on('replymessage', function(obj) { <% end %>
+
- cammie + cammie
@@ -59,7 +64,7 @@ socket.on('replymessage', function(obj) {
-