summaryrefslogtreecommitdiff
path: root/templates/webcam/show_video.html
blob: e3b49caafbaa82f5485f54834a0050680ed643fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{% extends "layout.html" %}
{% load staticfiles %}
{% block content %}
<div class="container">
    <div class="row">
        {% include "account/sub_nav.html" %}
        <script>
        document.getElementById("video-nav").classList.add("active");
        </script>
        <div class="span12">
            <h3>SBHS live feed: Machine ID {{ mid }}</h3>
            <div class="span4 offset4" style="text-align: center">
            </div>



              {% if mid > 10 %}

 <img id="videoImage" src="http://10.102.152.16:8080/webcams/{{ mid }}/get_image_data" alt="SBHS live feed" class="span4 offset4" style="padding-bottom: 20px;">



               {% else %}

       
 <img id="videoImage" src="{% static image_link %}" alt="SBHS live feed" class="span4 offset4">
{% endif %}
            <div class="span4 offset4" style="text-align: center">
            <a href="#" onclick="image_reloader()" id="image_reloader" class="btn btn-primary btn-large">Refresh image</a>
            
            </div>
        </div>
    </div>
</div>
<script>
{% if user.is_admin %}
setInterval(function() {
    var refresh = new Image();
    refresh.src = "{% url 'webcam_reload_image' mid %}";
    document.getElementById("videoImage").src = "{% static image_link %}?" + new Date().getTime();
}, 2000);
{% else %}
window.image_reloader = function() {
    var button = document.getElementById("image_reloader");

    
    if (!button.disabled) {
        button.setAttribute("disabled", true);
        var refresh = new Image();
        refresh.src = "{% url 'webcam_reload_image' mid  %}";
        document.getElementById("videoImage").src = "{% static image_link %}?" + new Date().getTime();
        setTimeout(function(){
            button.removeAttribute('disabled');
        }, 3000);
    }
};

(function(){image_reloader();})();
{% endif %}
</script>
{% endblock %}