]> git.parisson.com Git - teleforma.git/commitdiff
try to invalidate live video cache url by random variable
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 29 Jun 2021 12:31:55 +0000 (14:31 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 29 Jun 2021 12:31:55 +0000 (14:31 +0200)
teleforma/templates/teleforma/course_conference.html

index ae6129027f0499f07477f1e80ad31b7ab5c48770..e66b4c438a78c20cdaffdfeb34a56eec7aea172e 100644 (file)
@@ -2,6 +2,28 @@
 {% load teleforma_tags %}
 {% load i18n %}
 
+
+{% block extra_javascript %}
+{{ block.super }}
+
+<script type="text/javascript">
+    function getRndInteger(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }
+
+    jQuery(window).ready(function() {
+        let video = $("#video");
+        let videoSource = $("#video source");
+        let url = videoSource.attr("src");
+        url = url + "?v=" + getRndInteger(1, 10000);
+        videoSource.attr("src", url);
+        let autoplayVideo = $("#videoclip").get(0);
+        autoplayVideo.load();
+        autoplayVideo.play();
+    });
+</script>
+
+{% endblock %}
+
+
 {% block module-action %}
 {% get_telecaster as telecaster %}
 {%  if telecaster %}
@@ -47,8 +69,8 @@
     {% for livestream in livestreams %}
         {% if "webm" == livestream.stream_type %}
             <div class="video">
-                <video width="100%" height="auto" controls>
-                    <source src="{{ livestream.url|get_host:host }}" type="video/webm" />
+                <video id="video" width="100%" height="auto" controls>
+                    <source id="videosource" src="{{ livestream.url|get_host:host }}" type="video/webm" />
                 </video>
             </div>
         {% endif %}