Announcements

Proper MPRIS support

Reply
Highlighted

Proper MPRIS support

Roadie
MPRIS support in the Linux desktop client is very limited up to and including not reporting a couple important mandatory properties and a signal. In an effort to be respectful and fair, I acknowledge that the Linux client gets very little dev time and the MPRIS spec is not the easiest to understand so I will start with the basics. Mandatory properties not reported: Volume - Volume is a Read/Write property, a double (variant signature "d") with a value range of 0.0 - 1.0. Pretty simple, basically a getter and a setter. You already use something very similar to get and set the position of the volume slider in the main window UI I'm sure. A prop change signal must be emitted when ever the volume changes. Position - Position is a Read only property, a int64 (variant signature "x") The current track position in microseconds. Again very simple, just a getter. A prop change signal must NOT be emitted when ever the position changes. (that would be a ridiculous amount of updates for no real reason) Mandatory signal not emitted: Seeked - When the playback position changes inconsistently, i.e. when a user seeks to a certain position the Seeked signal must be emitted with new position in the form of a int64 (variant signature "x") The new position in microseconds. Care must be taken though. You don't want to just emit the signal with the current position if a seek has not yet been completed. So you'd want to make sure that, User Seeked > Seek is complete > Seek signal is finally emitted. Or at the very least emit the signal with expected/desired position NOT the current position. Otherwise you may end up emitting an incorrect/stale position value.
3 Replies
Highlighted

Re: Proper MPRIS support

Regular

MPRIS support has been incomplete for years and this has been brought up multiple times on this forum. I wouldn't get my hopes up on this getting fixed any time soon.
I recently wrote a small program that gets the data from the spotify web api and makes it accessible using MPRIS. You can try that if you need support for Position, Seeked and Volume: https://github.com/freundTech/SpotPRIS2

Highlighted

Re: Proper MPRIS support

Roadie

> MPRIS support has been incomplete for years and this has been brought up multiple times on this forum. I wouldn't get my hopes up on this getting fixed any time soon.

I realize that. It's just so frustrating that it's so simple yet no one bothers. I mean really give me a crack at the source code and I could fix it in an afternoon.

> I recently wrote a small program that gets the data from the spotify web api and makes it accessible using MPRIS. You can try that if you need support for Position, Seeked and Volume: 
https://github.com/freundTech/SpotPRIS2

That's not really helpful since you can't disable MPRIS in the app. You'd end up with 2 basically duplicate interfaces. It might be useful for 3rd party Spotify players though.

Highlighted

Re: Proper MPRIS support

Roadie

I am a contributor to the unofficial flatpak Spotify package and we have actually done a lot to workaround several of the official package's paper cuts/bugs.

It's possible to shim the default MPRIS interface. Basically intercept it and fill in the missing bits with the web api, and between the 2 create an actual working complete interface as far as the end user is concerned. One of these days I'll get around to it...  

SUGGESTED POSTS