fix: reset progress bar to 0:00 immediately on track change on web too

This commit is contained in:
Honey committed 2026-05-13 12:46:58 +02:00
1 parent 10e3e0eb1d
commit 751cc05b89
1 file changed
+3 -2
+3 -2
View File
@@ -294,6 +294,7 @@ export function playCurrent() {
const gen = ++_playGen; const gen = ++_playGen;
S._trackChanging = true; S._trackChanging = true;
_resetProgressUI();
if(navigator.mediaSession) navigator.mediaSession.playbackState = 'playing'; if(navigator.mediaSession) navigator.mediaSession.playbackState = 'playing';
updatePlayerUI(s, true); updatePlayerUI(s, true);
onNpSongChange(s.id); onNpSongChange(s.id);
@@ -473,7 +474,7 @@ function _setSkipping() {
} }
function _resetProgressUI() { function _resetProgressUI() {
_nativePos = 0; if (HAS_BRIDGE) _nativePos = 0;
document.getElementById('progress-fill').style.width = '0%'; document.getElementById('progress-fill').style.width = '0%';
document.getElementById('time-cur').textContent = formatDur(0); document.getElementById('time-cur').textContent = formatDur(0);
if (S.npOpen) { if (S.npOpen) {
@@ -497,7 +498,7 @@ export function prevSong() {
_nsBridge('prev'); _nsBridge('prev');
return; return;
} }
if(S.audio.currentTime > 3) { S.audio.currentTime = 0; return; } if(S.audio.currentTime > 3) { _resetProgressUI(); S.audio.currentTime = 0; return; }
if(S.qIdx > 0) { S.qIdx--; playCurrent(); } if(S.qIdx > 0) { S.qIdx--; playCurrent(); }
} }