diff --git a/front/src/composables/audio/player.ts b/front/src/composables/audio/player.ts index 7490326f8..1fae61beb 100644 --- a/front/src/composables/audio/player.ts +++ b/front/src/composables/audio/player.ts @@ -167,12 +167,20 @@ export const usePlayer = createGlobalState(() => { }, 1000) // Progress + let lastProgress = 0 useRafFn(() => { const sound = currentSound.value - document.documentElement.style.setProperty('--fw-track-progress', sound - ? `${(sound.currentTime / sound.duration * 100).toFixed(Math.log(window.innerWidth))}%` - : '0' - ) + const progress = sound + ? +(sound.currentTime / sound.duration * 100).toFixed(Math.log(window.innerWidth)) + : 0 + + if (progress !== lastProgress) { + lastProgress = !isNaN(progress) + ? progress + : 0 + + document.documentElement.style.setProperty('--fw-track-progress', `${lastProgress}%`) + } }) // Loading