So I'm trying to get a current timestamp as in something with HH:MM:SS from an HTML5 video. I'm using a variation of this:
HTML
<video
id="video-active"
class="video-active"
width="640"
height="390"
controls="controls">
<source src="myvideo.mp4" type="video/mp4">
</video>
<div id="current">0:00</div>
<div id="duration">0:00</div>
JQUERY
$(document).ready(function(){
$("#video-active").on(
"timeupdate",
function(event){
onTrackedVideoFrame(this.currentTime, this.duration);
});
function onTrackedVideoFrame(currentTime, duration){
$("#current").text(currentTime);
$("#duration").text(duration);
}
My main problem is that the current and duration divs are just showing the 0:00 and nothing else. Is there something wrong with the code, or is there an easier way to get the timestamp of an HTML video?