fix: pwa changes

This commit is contained in:
Honey committed 2026-05-02 21:27:57 +02:00
1 parent 89abc81875
commit a5959b19b8
3 files changed
+10 -2

No files matched your search

+7 -1
View File
@@ -17,8 +17,14 @@ export function playQueue(songs, startIdx) {
export function playCurrent() {
if(S.qIdx < 0 || S.qIdx >= S.queue.length) return;
const s = S.queue[S.qIdx];
// Pre-update MediaSession before src change so the OS never sees a "paused" flash
// (setting src fires pause synchronously; _changingTrack suppresses that in the pause handler)
updateMediaSession(s);
if(navigator.mediaSession) navigator.mediaSession.playbackState = 'playing';
S._changingTrack = true;
S.audio.src = streamUrl(s.id);
S.audio.play();
S._changingTrack = false;
S.audio.play().catch(() => {});
updatePlayerUI(s);
onNpSongChange(s.id);
renderQueue();