feat: synced lyrics view in Now Playing overlay
Adds a Lyrics tab to the NP overlay using Navidrome's getLyricsBySongId endpoint. Synced lyrics auto-scroll and highlight the current line as the track plays; tapping a line seeks to that position. Falls back to plain text for unsynced lyrics. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
93b859bf0e
commit
fbabdf8269
6 files changed
+99
-4
No files matched your search
+4
-1
@@ -1,8 +1,9 @@
|
||||
import { S } from './state.js';
|
||||
import { esc, formatDur, toast } from './utils.js';
|
||||
import { api, streamUrl, coverUrl, downloadUrl } from './api.js';
|
||||
// views.js circular import — safe because only used inside function bodies
|
||||
// views.js/ui.js circular imports — safe (only used inside function bodies)
|
||||
import { loadRecommendations } from './views.js';
|
||||
import { updateLyricsHighlight, onNpSongChange } from './ui.js';
|
||||
|
||||
// ─── PLAYBACK ───
|
||||
export function playQueue(songs, startIdx) {
|
||||
@@ -19,6 +20,7 @@ export function playCurrent() {
|
||||
S.audio.src = streamUrl(s.id);
|
||||
S.audio.play();
|
||||
updatePlayerUI(s);
|
||||
onNpSongChange(s.id);
|
||||
renderQueue();
|
||||
}
|
||||
|
||||
@@ -153,6 +155,7 @@ export function updateProgress() {
|
||||
if(fill) fill.style.width = p + '%';
|
||||
if(cur) cur.textContent = formatDur(S.audio.currentTime);
|
||||
if(tot) tot.textContent = formatDur(S.audio.duration);
|
||||
if(S.npLyricsMode) updateLyricsHighlight(S.audio.currentTime * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user