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