• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<body>
3    <video id='video' name='media' height="480" width="854">
4        <source src='' type='video'>
5    </video>
6    <br>
7Current time (seconds): <span id='videoCurTime'>0</span>
8</body>
9
10<script type="text/javascript">
11var can_play = false;
12var script_ready = false;
13var finished_seeking = false;
14var error_status = false;
15
16(function() {
17     var timeEle = document.getElementById('videoCurTime');
18     video.addEventListener('timeupdate', function(event) {
19     timeEle.innerHTML = video.currentTime;
20  }, false);
21})();
22
23(function() {
24     video.addEventListener('canplay', function(event) {
25     can_play = true;
26  }, false);
27})();
28
29(function() {
30     video.addEventListener('error', function(event) {
31     error_status = true;
32  }, false);
33})();
34
35(function() {
36     video.addEventListener('seeked', function(event) {
37     finished_seeking = true;
38  }, false);
39})();
40
41(function() {
42     video.addEventListener('seeking', function(event) {
43     finished_seeking = false;
44  }, false);
45})();
46
47function loadVideoSource(video_source_path) {
48    video.src = video_source_path;
49    return true;
50}
51
52function canplay() {
53    return can_play;
54}
55
56function finishedSeeking() {
57    return finished_seeking;
58}
59
60function play() {
61    video.play();
62}
63
64function pause() {
65    video.pause();
66}
67
68function currentTime()  {
69    return video.currentTime;
70}
71
72function errorDetected() {
73  return error_status;
74}
75
76function setControls() {
77    video.setAttribute("controls","true");
78}
79script_ready = true;
80</script>
81</html>
82