Fix: Robust metadata refresh
This commit is contained in:
parent
6669c6854a
commit
fc53295ced
1 changed files with 5 additions and 1 deletions
|
|
@ -205,7 +205,6 @@ export class Player {
|
||||||
document.title = `${trackTitle} • ${getTrackArtists(track)}`;
|
document.title = `${trackTitle} • ${getTrackArtists(track)}`;
|
||||||
|
|
||||||
this.updatePlayingTrackIndicator();
|
this.updatePlayingTrackIndicator();
|
||||||
this.updateMediaSession(track);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let streamUrl;
|
let streamUrl;
|
||||||
|
|
@ -228,6 +227,8 @@ export class Player {
|
||||||
}
|
}
|
||||||
await this.audio.play();
|
await this.audio.play();
|
||||||
|
|
||||||
|
// Update Media Session AFTER play starts to ensure metadata is captured
|
||||||
|
this.updateMediaSession(track);
|
||||||
this.updateMediaSessionPlaybackState();
|
this.updateMediaSessionPlaybackState();
|
||||||
this.preloadNextTracks();
|
this.preloadNextTracks();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -468,6 +469,9 @@ export class Player {
|
||||||
updateMediaSession(track) {
|
updateMediaSession(track) {
|
||||||
if (!('mediaSession' in navigator)) return;
|
if (!('mediaSession' in navigator)) return;
|
||||||
|
|
||||||
|
// Force a refresh for picky Bluetooth systems by clearing metadata first
|
||||||
|
navigator.mediaSession.metadata = null;
|
||||||
|
|
||||||
const artwork = [];
|
const artwork = [];
|
||||||
const sizes = ['320'];
|
const sizes = ['320'];
|
||||||
const coverId = track.album?.cover;
|
const coverId = track.album?.cover;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue