diff --git a/templates/macros.html b/templates/macros.html index 63d34cb8cd775980edf318e0d83a597ce1fc9424..d0a31d54347c749d657d97c8f6aace4a8b17c01a 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -59,6 +59,8 @@ $('#videoplayer').addClass("vjs-16-9"); $('#videoplayer').css("width"); $(function() { +videojs("videoplayer").ready(function() { + //resume var progress_key = "progress_{{ lecture.id }}"; var seconds_played; @@ -92,11 +94,20 @@ $(function() { if (document.hasFocus()) { playerplay(); } + + var modals = []; //display errors {% for msg in msgs %} - videojs("videoplayer").createModal('',{"uncloseable": true }).contentEl().innerHTML='<div class="hidden-print alert alert-danger" role="alert">{{ msg|safe }}</div>'; + var m = videojs("videoplayer").createModal('',{"uncloseable": true }); + modals.push(m); + m.contentEl().innerHTML='<div class="hidden-print alert alert-danger" role="alert">{{ msg|safe }}</div>'; {% endfor %} + videojs("videoplayer").on('play', function() { + for (var i=0; i < modals.length; i++) { + modals[i].close(); + } + }); //markers $.ajax({method: "GET", url: "{{url_for('chapters',lectureid=lecture.id, json=1)}}", dataType: "json", @@ -116,6 +127,7 @@ $(function() { markers: data}); }}); +}); }); </script> {% endmacro %}