I am creating a video player and I want to create a function which will show the video time which is equivalent input range when i hover on input range.
I created a function, but it gives me not accurate time.
function getHoveredTime(e) {
const time = e.offsetX * video.duration / e.target.getBoundingClientRect().width;
const min = Math.floor(time / 60);
const sec = Math.floor(time - min * 60);
return min + ':' + sec;
}