1 <html> 2 <body> 3 <video id='video' name='media' height="480" width="854"> 4 <source src='' type='video'> 5 </video> 6 <br> 7 Current time (seconds): <span id='videoCurTime'>0</span> 8 </body> 9 10 <script type="text/javascript"> 11 var can_play = false; 12 var finished_seeking = false; 13 14 (function() { 15 var timeEle = document.getElementById('videoCurTime'); 16 video.addEventListener('timeupdate', function(event) { 17 timeEle.innerHTML = video.currentTime; 18 }, false); 19 })(); 20 21 (function() { 22 video.addEventListener('canplaythrough', function(event) { 23 can_play = true; 24 }, false); 25 })(); 26 27 (function() { 28 video.addEventListener('seeked', function(event) { 29 finished_seeking = true; 30 }, false); 31 })(); 32 33 (function() { 34 video.addEventListener('seeking', function(event) { 35 finished_seeking = false; 36 }, false); 37 })(); 38 39 function loadVideoSource(video_source_path) { 40 video.src = video_source_path; 41 return true; 42 } 43 44 function canplay() { 45 return can_play; 46 } 47 48 function finishedSeeking() { 49 return finished_seeking; 50 } 51 52 function play() { 53 video.play(); 54 } 55 56 function pause() { 57 video.pause(); 58 } 59 60 function currentTime() { 61 return video.currentTime; 62 } 63 </script> 64 </html> 65