1 // This is a javascript file for both mp4video.html and webmvideo.html. 2 3 var videoAtStart = false; 4 var testvideo = document.getElementById('testvideo'); 5 6 function playAndReload() { 7 // Reload video after playing for several seconds. 8 testvideo.addEventListener("timeupdate", function() { 9 if (testvideo.currentTime > 3) { 10 location.reload(); 11 }}); 12 13 testvideo.play(); 14 videoAtStart = false; 15 } 16 17 function contentLoaded() { 18 testvideo.addEventListener("loadeddata", function() { 19 if (testvideo.currentTime == 0) videoAtStart = true; }); 20 } 21 22 document.addEventListener("DOMContentLoaded", contentLoaded); 23