Skip to content

Commit

Permalink
Add warning on camera feed disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
msathieu committed Oct 26, 2023
1 parent 32a8d21 commit a1d201d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions content/assets/scripts/cammie.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ debounce = function(func, wait, initial) {
function cammie_error() {
$("#cammie-feed").attr("src","/assets/images/cammie_down.svg")
}
var cammieTimeout = null;
function cammie_loaded() {
if (cammieTimeout) {
clearTimeout(cammieTimeout);
}
showWarning = function() {
$("#cammieFeedDisconnected").removeClass("is-hidden");
};
cammieTimeout = setTimeout(showWarning, 5000);
}

$("#cammie-ctrls").mousemove(debounce(function() {
return $(this).removeClass('display');
Expand Down
5 changes: 4 additions & 1 deletion content/cammie.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ socket.on('replymessage', function(obj) {
<% end %>

<section id="cammie-section">
<div id="cammieFeedDisconnected" class="notification is-danger is-light is-hidden">
Camera feed disconnected, reload the page
</div>
<div id="cammie-body">
<figure class="image is-16by9">
<img id="cammie-feed" alt="cammie" src="https://kelder.zeus.ugent.be/camera/cammie" onerror="cammie_error()">
<img id="cammie-feed" alt="cammie" src="https://kelder.zeus.ugent.be/camera/cammie" onerror="cammie_error()" onload="cammie_loaded()">
</figure>
<div id="cammie-ctrls">
<div class="columns is-mobile">
Expand Down

0 comments on commit a1d201d

Please sign in to comment.