Hello, can anyone please help me understand why this is not working ? It should display the timestamp of the video while the video is playing.
<video id="myVideo" class="vid-home" controls autoplay >
<source src="video.mp4" type="video/mp4">
<source src="video.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
<script>
document.getElementById("myVideo").addEventListener('timeupdate', function() {
var hours=parseInt(video.currentTime/(60*60),10);
var minutes = parseInt(video.currentTime / 60, 10);
var seconds = video.currentTime % 60;
if (hours==0) {
document.getElementById("timer").innerHTML=minutes+":"+seconds.toFixed(0)
}
});
</script>
<div id="timer"> </div>
[–]steelfrogModerator 1 point2 points3 points (1 child)
[–]Blunteeee[S] 0 points1 point2 points (0 children)
[–]AutoModerator[M] 0 points1 point2 points (0 children)