I have a simple custom HTML 5 video player, I would like to add markers to my video player, progress indication bar something like this.
So far Here is my solution just for one marker at 0.6s.
HTML
<div canplay id="video-block">
<div id="video-container">
<video id="videoplayer" ref="video" autoplay webkit-playsinline playsinline>
<source src="videos/vmerce.mp4" type="video/mp4">
</video>
</div>
<div id="video-controls" style="position: relative; display: block">
<div id="seek-bar-container">
<div id="seek-bar">
<div id="current-time">
</div>
</div>
</div>
<div id="pause-play-button">
<img id="play" src="images/play.png">
<img id="pause" src="images/pause.png" style="display:none">
</div>
</div>
</div>
Here is js to add markers
$(document).ready(function(){
//get videoplayer tag element
var videoplayerID =document.getElementById("videoplayer");
var ranges = [{
from: 0,
to: 6
},
{
from: 6,
to: 9
},
{
from: 9,
to: 25
},
{
from: 25,
to: 38
},
];
console.log(ranges[0].to);
videoplayerID.addEventListener("timeupdate", function () {
if ($(this)[0].duration) {
$(this).parent().parent().find("#current-time").css("width", ($(this)[0].currentTime * 100 / $(this)[0].duration) + "%");
}
if (this.currentTime >= ranges[0].to) {
var bb =$('<div class="bubles"></div>')
$("#current-time").append(bb);
}
});
})
Now when I run my app I get the following.
What do I need to do to get what I want?

