• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<body>
3    <video id='video' name='media' height="480" width="854" controls>
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 finished_seeking = false;
13var error_status = false;
14
15(function() {
16     var timeEle = document.getElementById('videoCurTime');
17     video.addEventListener('timeupdate', function(event) {
18     timeEle.innerHTML = video.currentTime;
19  }, false);
20})();
21
22(function() {
23     video.addEventListener('canplay', function(event) {
24     can_play = true;
25  }, false);
26})();
27
28(function() {
29     video.addEventListener('error', function(event) {
30     error_status = true;
31  }, false);
32})();
33
34(function() {
35     video.addEventListener('seeked', function(event) {
36     finished_seeking = true;
37  }, false);
38})();
39
40(function() {
41     video.addEventListener('seeking', function(event) {
42     finished_seeking = false;
43  }, false);
44})();
45
46function loadVideoSource(video_source_path) {
47    video.src = video_source_path;
48    return true;
49}
50
51function canplay() {
52    return can_play;
53}
54
55function finishedSeeking() {
56    return finished_seeking;
57}
58
59function play() {
60    video.play();
61}
62
63function pause() {
64    video.pause();
65}
66
67function currentTime()  {
68    return video.currentTime;
69}
70
71function errorDetected() {
72  return error_status;
73}
74</script>
75</html>
76