I trying to set metadata in injected script on music website like this
var updateMediaSessionMetadata = function() {
if (!navigator.mediaSession)
return;
var coverPath = trackInfo["coverPath"];
var cover = { src: coverPath, sies: "256x256", type: "image/jpeg" }
var metadata = new MediaMetadata({
title: trackInfo["name"],
artist: trackInfo["artists"],
album: trackInfo["album"],
artwork: [ cover
// { src: coverPath.replace("400x400", "80x80"), sizes: "80x80", type: "image/*" },
// { src: coverPath.replace("400x400", "100x100"), sizes: "100x100", type: "image/*" },
// { src: coverPath.replace("400x400", "200x200"), sizes: "200x200", type: "image/*" },
// { src: coverPath.replace("400x400", "300x300"), sizes: "300x300", type: "image/*" },
// { src: coverPath.replace("400x400", "400x400"), sizes: "400x400", type: "image/*" }
]
});
As you can see i try different image size. But unfortunately the cover in Now Playing widget doesn‘t appear. How to fix that? Note that title, artist and album set as appropriate. Link coverPath is correct.
Enviroment macOS Ventura 13.0.1 (22A400) Safari 16.1 (18614.2.9.1.12)
