Fix for calculating right position in seekbar preview

This commit is contained in:
Kavin 2023-04-17 00:00:32 +01:00 committed by GitHub
parent a062773126
commit 7ce0c0fcc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -718,7 +718,7 @@ export default {
let seekBar = document.querySelector(".shaka-seek-bar-container"); let seekBar = document.querySelector(".shaka-seek-bar-container");
// load the thumbnail preview when the user moves over the seekbar // load the thumbnail preview when the user moves over the seekbar
seekBar.addEventListener("mousemove", e => { seekBar.addEventListener("mousemove", e => {
const position = (this.video.duration * e.clientX) / seekBar.clientWidth; const position = (e.offsetX / e.target.offsetWidth) * this.video.duration;
this.showSeekbarPreview(position * 1000); this.showSeekbarPreview(position * 1000);
}); });
// hide the preview when the user stops hovering the seekbar // hide the preview when the user stops hovering the seekbar