blob: d0b866f20a4bf54f376fa4aeb01934fea20f07bc [file] [log] [blame] [edit]
<html>
<body>
<video id='video' name='media' height="480" width="854">
<source src='' type='video'>
</video>
<br>
Current time (seconds): <span id='videoCurTime'>0</span>
</body>
<script type="text/javascript">
var can_play = false;
var script_ready = false;
var finished_seeking = false;
var error_status = false;
var video_ended = false;
(function() {
var timeEle = document.getElementById('videoCurTime');
video.addEventListener('timeupdate', function(event) {
timeEle.innerHTML = video.currentTime;
}, false);
})();
(function() {
video.addEventListener('canplay', function(event) {
can_play = true;
}, false);
})();
(function() {
video.addEventListener('error', function(event) {
error_status = true;
}, false);
})();
(function() {
video.addEventListener('seeked', function(event) {
finished_seeking = true;
}, false);
})();
(function() {
video.addEventListener('seeking', function(event) {
finished_seeking = false;
}, false);
})();
(function() {
video.addEventListener('ended', function(event) {
video_ended = true;
}, false);
})();
function loadVideoSource(video_source_path) {
video.src = video_source_path;
return true;
}
function canplay() {
return can_play;
}
function finishedSeeking() {
return finished_seeking;
}
function play() {
video.play();
}
function pause() {
video.pause();
}
function currentTime() {
return video.currentTime;
}
function errorDetected() {
return error_status;
}
function endOrError() {
return video_ended || error_status;
}
function setControls() {
video.setAttribute("controls","true");
}
script_ready = true;
</script>
</html>