diff --git a/src/player/nowplaying.js b/src/player/nowplaying.js index 25242f2..0e2ee2a 100644 --- a/src/player/nowplaying.js +++ b/src/player/nowplaying.js @@ -100,6 +100,7 @@ export function switchNpTab(tab) { let _lyricsLines = []; let _lyricsSongId = null; let _lyricsLoadToken = 0; +let _prefetchTimer = null; const _lyricsCache = new Map(); // "artist|title" → result object (null = not found) const LYRICS_LOOKAHEAD_MS = 200; @@ -283,8 +284,11 @@ export function onNpSongChange(songId) { _lyricsLines = []; const content = document.getElementById('np-lyrics-content'); if(content) content.innerHTML = ''; - // Warm the cache the moment the song changes, so the Lyrics tab opens instantly. - prefetchLyrics(S.queue.find(x => x.id === songId) || S.queue[S.qIdx]); + // Warm the cache shortly AFTER the track starts — deferred so the lyrics requests + // don't compete with the audio stream and delay playback start. + clearTimeout(_prefetchTimer); + const song = S.queue.find(x => x.id === songId) || S.queue[S.qIdx]; + _prefetchTimer = setTimeout(() => prefetchLyrics(song), 1500); if(S.npLyricsMode) _loadNpLyrics(songId); }