fix(mobile): restore playback state + MediaSession stability
- _restoreLastPlayed: set audio.src + call updateMediaSession so play button works immediately and notification shows artwork on app open - visibilitychange: re-register all MediaSession handlers after screen unlock, fold/flip, or background return (fixes vanishing notification) - Stall watchdog (3s interval): detects frozen audio in background and calls play() to recover; also catches missed 'ended' events so auto-advance works reliably when screen is off - stalled/error listeners: attempt audio reload on network hiccup Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
74743a81e6
commit
e31ddec843
2 files changed
+43
-1
No files matched your search
@@ -353,5 +353,9 @@ export function _restoreLastPlayed() {
|
||||
art.innerHTML = cv ? `<img src="${cv}" style="width:100%;height:100%;object-fit:cover">` : '<div class="no-art">♪</div>';
|
||||
updateStarBtn();
|
||||
document.title = `${s.title} — NovaSonic`;
|
||||
// set src so the play button works immediately without needing to re-select the song
|
||||
S.audio.src = streamUrl(s.id);
|
||||
S.audio.load();
|
||||
updateMediaSession(s);
|
||||
} catch {}
|
||||
}
|
||||
Reference in new issue
Block a user