Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140817

how to get the time of the video player which is equivalent the input type range

$
0
0

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;
}

Viewing all articles
Browse latest Browse all 140817

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>