mediaSession artwork not displaying
See original GitHub issueDear martpie,
I hope you don’t take it wrong. This question is not about Museeks, but about a music player of my own, which I’m trying to build. Feel free to ignore this issue 😃
So here is the question, as I described in Stack Overflow: Inspired by your code, I’m trying to access the album cover with fs, as base64 and display it in mediaSession’s artwork. This is my code:
const cover = this.getCover(this.playback.album.coverPath);
// Setup media session metadata
let metadata = {
title: this.playback.track.title,
album: this.playback.album.title,
artist: this.playback.album.artist,
artwork: cover? [{ src: cover }] : null
};
navigator.mediaSession.metadata = new MediaMetadata(metadata);
function getCover(coverPath) {
const data = fs.readFileSync(coverPath, { encoding: 'base64' });
const format = path.extname(coverPath).substr(1);
return `data:${format};base64,${data}`;
}
This is not working on Ubuntu, only on Windows. I know that you code is almost the same, and it works in my OS. Have you gone through the same problem? Have you found any solutions?
Thank you so much, m7kra
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Media session's artwork not showing up - Stack Overflow
The code runs without errors, but no image appears. On the console, typing navigator.mediaSession.metadata.artwork[0].src results in the correct ...
Read more >Unable to set image in media sessions metadata
Open Now playing widget. Title, artist, album is set correctly. Cover not set. macOS 13.0.1 (22A400) Safari 16.1 (18614.2.9.1.
Read more >MediaMetadata.artwork - Web APIs - MDN Web Docs
The artwork property of the MediaMetaData interface returns or sets an array of ... and sets the current metadata for the media session....
Read more >When and how should we load media metadata artwork? #58
Right now the spec does not say we must wait for the fetch steps to complete before showing media controls. I agree it...
Read more >Media Session Standard - W3C
Many platforms can display media metadata, such as title, artist, album and album ... Optionally, if the active media session is not null:....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

My Ubuntu installation is nearly new (1 week), because I got messed up with the 22.04 update 😐 and reinstalled everything to have a clean machine. Actually, that’s a proof that the issue doesn’t depend on the DE: when I opened this issue, I was using Ubuntu 20.04. Today, that installation has been erased and I’m on Ubuntu 22.04. Furthermore, playing a video on Youtube doesn’t show an artwork, but in Windows it does. I believe that it’s not an issue with Museeks itself, but with the Chromium Electron uses.
mmmh that’s weird, mediaSession should cover mpris usecases (I tested on vanilla ubuntu and elementary), and I deliberatly moved away from
mpris-serviceto avoid bundling native dependencies (it’s complicated to make all of this work).I’ll have to try on fresh ubuntu VMs, but I suspect an issue with your DE, more than with Museeks. There’s actually an easy way to test that: open spotify or youtube music, and see if it displays on mpris. If it does not, then it’s a DE issue. If it does, then it’s an issue with Museeks.