fix: stable notification artwork + canplay retry for background audio
- Cache cover art URLs per song so the same auth token is reused across metadata updates; Samsung/Chrome can cache the artwork image and the notification no longer visually reloads on every skip - Add canplay listener as background-safe play() retry: the audio element fires canplay from its internal state machine (not throttled like setTimeout by Android Doze), so play() is retried as soon as the browser has buffered enough data - Set navigator.audioSession.type='playback' on each _tryPlay attempt (not just on play event) so the OS audio session claim happens before Chrome requests the play grant - Guard _onForeground playbackState assignment with !_trackChanging to prevent visibilitychange/pageshow from stomping 'playing' to 'paused' during an in-progress track transition Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f5a5a4c43
commit
a0c6d09c41
2 files changed
+24
-4
No files matched your search
+2
-1
@@ -166,7 +166,8 @@ window.addEventListener('load', () => {
|
||||
const s = S.queue[S.qIdx];
|
||||
if(!s) return;
|
||||
updateMediaSession(s);
|
||||
if(navigator.mediaSession)
|
||||
// Don't stomp playbackState during a src-swap — _trackChanging guards the transition
|
||||
if(navigator.mediaSession && !S._trackChanging)
|
||||
navigator.mediaSession.playbackState = S.audio.paused ? 'paused' : 'playing';
|
||||
// If audio was playing before backgrounding but is now paused (OS kill), try to resume
|
||||
if(!S.audio.paused) return;
|
||||
|
||||
Reference in new issue
Block a user