diff --git a/src/player/player.js b/src/player/player.js index bff1412..dde188b 100644 --- a/src/player/player.js +++ b/src/player/player.js @@ -47,6 +47,12 @@ function _cancelScrobble() { function _scrobbleNow(s) { if (s) api('scrobble', `&id=${s.id}&time=${Date.now()}`).catch(() => {}); } +// "Now Playing" ping (submission=false) — tells the server what's playing *right now* so +// getNowPlaying (and e.g. a Discord rich-presence plugin) updates instantly. This is distinct +// from the delayed "played" scrobble above, which counts the play for stats / Last.fm. +function _scrobbleNowPlaying(s) { + if (s) api('scrobble', `&id=${s.id}&submission=false`).catch(() => {}); +} // Unified duration / position / seek helpers — use native state when available, // fall back to HTMLAudioElement when not. @@ -404,6 +410,7 @@ export function playCurrent() { updateMediaSession(s); onNpSongChange(s.id); renderQueue(); + _scrobbleNowPlaying(s); // "läuft gerade" sofort an Navidrome (getNowPlaying) _scheduleScrobble(s.id, s.duration); const _resetFlag = () => { if (_playGen === gen) S._trackChanging = false; };