blob: d0b866f20a4bf54f376fa4aeb01934fea20f07bc [file] [log] [blame]
avinash kodipelli97043792016-01-05 14:36:50 -08001<html>
2<body>
Mussa83a3d082016-03-14 14:55:16 -07003 <video id='video' name='media' height="480" width="854">
avinash kodipelli97043792016-01-05 14:36:50 -08004 <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;
avinash kodipelli6c756ed2016-01-27 12:12:08 -080012var script_ready = false;
avinash kodipelli97043792016-01-05 14:36:50 -080013var finished_seeking = false;
avinash kodipellia0d33212016-01-13 10:36:22 -080014var error_status = false;
Hirokazu Honda2d1a58a2017-04-24 13:33:01 +090015var video_ended = false;
avinash kodipelli97043792016-01-05 14:36:50 -080016
17(function() {
18 var timeEle = document.getElementById('videoCurTime');
19 video.addEventListener('timeupdate', function(event) {
20 timeEle.innerHTML = video.currentTime;
21 }, false);
22})();
23
24(function() {
Mussab0eea2a2016-02-01 17:21:39 -080025 video.addEventListener('canplay', function(event) {
avinash kodipelli97043792016-01-05 14:36:50 -080026 can_play = true;
27 }, false);
28})();
29
30(function() {
avinash kodipellia0d33212016-01-13 10:36:22 -080031 video.addEventListener('error', function(event) {
32 error_status = true;
33 }, false);
34})();
35
36(function() {
avinash kodipelli97043792016-01-05 14:36:50 -080037 video.addEventListener('seeked', function(event) {
38 finished_seeking = true;
39 }, false);
40})();
41
42(function() {
43 video.addEventListener('seeking', function(event) {
44 finished_seeking = false;
45 }, false);
46})();
47
Hirokazu Honda2d1a58a2017-04-24 13:33:01 +090048(function() {
49 video.addEventListener('ended', function(event) {
50 video_ended = true;
51 }, false);
52})();
53
54
55
avinash kodipelli97043792016-01-05 14:36:50 -080056function loadVideoSource(video_source_path) {
57 video.src = video_source_path;
58 return true;
59}
60
61function canplay() {
62 return can_play;
63}
64
65function finishedSeeking() {
66 return finished_seeking;
67}
68
69function play() {
70 video.play();
71}
72
73function pause() {
74 video.pause();
75}
76
77function currentTime() {
78 return video.currentTime;
79}
avinash kodipellia0d33212016-01-13 10:36:22 -080080
81function errorDetected() {
82 return error_status;
83}
avinash kodipellid81b4222016-07-26 10:27:14 -070084
Hirokazu Honda2d1a58a2017-04-24 13:33:01 +090085function endOrError() {
86 return video_ended || error_status;
87}
88
89
avinash kodipellid81b4222016-07-26 10:27:14 -070090function setControls() {
91 video.setAttribute("controls","true");
92}
avinash kodipelli6c756ed2016-01-27 12:12:08 -080093script_ready = true;
avinash kodipelli97043792016-01-05 14:36:50 -080094</script>
95</html>