fix playback pos update on song change

This commit is contained in:
2024-10-19 15:05:34 +02:00
parent c9f487b981
commit 4ef98f80cf

View File

@@ -407,7 +407,8 @@
} }
let progressTracker = 0; let progressTracker: ReturnType<typeof setInterval> = setInterval( () => {}, 1000 );
clearInterval( progressTracker );
let hasReachedEnd = false; let hasReachedEnd = false;
let hasStarted = false; let hasStarted = false;
const startProgressTracker = () => { const startProgressTracker = () => {
@@ -432,6 +433,7 @@
} }
if ( pos.value > 0 && !hasStarted ) { if ( pos.value > 0 && !hasStarted ) {
if ( player.getPlaying() ) {
getDetails(); getDetails();
playingSong = player.getPlayingSong(); playingSong = player.getPlayingSong();
pos.value = player.getPlaybackPos(); pos.value = player.getPlaybackPos();
@@ -441,6 +443,7 @@
notificationHandler.emit( 'playback-start-update', new Date().getTime() - pos.value * 1000 ); notificationHandler.emit( 'playback-start-update', new Date().getTime() - pos.value * 1000 );
hasStarted = true; hasStarted = true;
} }
}
const minuteCount = Math.floor( pos.value / 60 ); const minuteCount = Math.floor( pos.value / 60 );
nicePlaybackPos.value = minuteCount + ':'; nicePlaybackPos.value = minuteCount + ':';