question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mediaSession artwork not displaying

See original GitHub issue

Dear 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:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
m7kracommented, Sep 5, 2022

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.

0reactions
martpiecommented, Sep 5, 2022

mmmh that’s weird, mediaSession should cover mpris usecases (I tested on vanilla ubuntu and elementary), and I deliberatly moved away from mpris-service to 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found