Fix media control progress bar jumping to 50%

This commit is contained in:
Slowlife01
2025-03-15 14:47:10 +07:00
parent d1098af7f0
commit 8ea7b497ff

View File

@@ -209,11 +209,12 @@ class ZenMediaController {
if (this._currentDuration >= 900_000) return this.mediaProgressBarContainer.setAttribute('hidden', 'true');
else this.mediaProgressBarContainer.removeAttribute('hidden');
if (!this._currentDuration) return;
this.mediaCurrentTime.textContent = this.formatSecondsToTime(this._currentPosition);
this.mediaDuration.textContent = this.formatSecondsToTime(this._currentDuration);
this.mediaProgressBar.value = (this._currentPosition / this._currentDuration) * 100;
if (this._currentMediaController?.isPlaying) {
this._mediaUpdateInterval = setInterval(() => {
if (this._currentMediaController?.isPlaying) {
this._currentPosition += 1;
@@ -228,7 +229,6 @@ class ZenMediaController {
}
}, 1000);
}
}
/**
* Formats seconds into a hours:minutes:seconds string.