Posts Tagged ‘mpris’

MPRIS2 and the Music Player Daemon

17th May 2012

If you tend to want to keep your music running when you log out, or control your music playing on a desktop machine from a laptop, for example, you may well use the Music Player Daemon (MPD).  If you use Ubuntu’s Unity desktop or KDE’s Plasma desktop, you may well wonder how to get the Ubuntu sound menu or Plasma’s Now Playing widget to talk to it.

Both of these use MPRIS2 to communicate with media players.  MPD, however, does not have an MPRIS2 interface.  Even if it did, it would take a bit of work to be able to use it from another computer.  What you need, then, is a “bridge” of some sort to translate.  One such possibility is mpDris2 (which, I hasten to point out, I haven’t tested).

You would run such a bridge on the computer you want to control MPD from, and point it to your MPD instance.  And voilà!  Every MPRIS2 client application that you run can talk to MPD, without knowing anything about the MPD protocol.

If you just want a headless music player on your local machine, though, you can always use Raven, which talks MPRIS2 natively.


New Now Playing Plasmoid, MPRIS2 dataengine

11th May 2012

One thing that will be in KDE Plasma Desktop 4.9 is a new version of the Now Playing widget.  Based on QML, it works much better, especially on panels (where its design is based heavily on my favourite KDE-3-era applet, kirocker).

Now Playing on a panel

In the background, it uses the new mpris2 dataengine.  This exclusively supports MPRIS2-capable media players (which these days is most), and doesn’t include any hacks to support XMMS 1, for example.  JuK and Dragon have both gained MPRIS2 support for the 4.9 release, and Ubuntu’s sound menu uses MPRIS2, which is compelling many other media players to support it.

Now Playing on the desktop

The result is a cleaner, more reliable design, and completely asynchronous behaviour, so it will use less power and (unlike the old nowplaying dataengine) it should never cause your desktop to freeze due to a badly-behaving media player.

Now Playing with the mouse over

The old nowplaying dataengine is still there (and will be until KDE Plasma Desktop 5 is released), but should not be used for new widgets.  Instead, you should use the mpris2 dataengine, and I highly recommend porting any existing widgets to mpris2 as well.

Overall, I’m really pleased with the design of MPRIS2, which allowed me to create the mpris2 dataengine with a minimum of fuss, and allowed for widgets to implement a seek bar without querying the media player once or twice a second to find the current position (and not take the performance/power hit if they didn’t care about the current playback position).

MPRIS now on

11th May 2012

This news is actually a bit old, but I thought I’d make use of my new presence on to say that the Media Player Remote Interfacing Specification is now using infrastructure, instead of a hodge-podge of other services.

You can view the specifiation, file a bug, view the git repository and participate on the mailing list.

If you’re creating an MPRIS2-capable media player, you may want to make use of the MPRIS tester application (which is actually not hosted on fd.o, but on GitHub).

MPRIS2 Support in NowPlaying

10th November 2011

Do you recall NowPlaying?  The dataengine/widget pair for Plasma that tells you what your media player is currently playing, and allows you to control it?

The Now Playing widget (with an old theme)

Well, now it supports MPRIS2.  What does this mean for you?

Well, probably not much right now.  Juk doesn’t support MPRIS2 (although I intend to change that for 4.9/5.0), Amarok worked before (although it should use marginally less power with MPRIS2 rather than the old MPRIS interface), VLC doesn’t support MPRIS2 (yet; version 1.2 will).  A handful of other players support MPRIS2, though, including the Raven Music Server.

The main thing, though, is that support for MPRIS2 is increasing in media players, partly because of Ubuntu’s adoption of it as the mechanism for its sound menu to talk to media players.  Spotify now supports MPRIS2, for example.  And now the Now Playing widget can support them.

MPRIS2 has many advantages over the original MPRIS specification, not least of which is not having to query the media player every second for up-to-date position information.  As a result, the nowplaying dataengine will prefer the MPRIS2 interface to the MPRIS interface for a media player that offers both.

The only quirk to be aware of is that Amarok’s MPRIS2 support isn’t quite right in the 2.4.x series, and this will affect a couple of features of the Now Playing widget (seeking and enabling/disabling of the next/previous buttons); this shouldn’t be an issue though, as these problems are fixed for Amarok 2.5, which will be released before KDE Plasma Workspace 4.8.

Now Playing: MPRIS

29th December 2007

MPRIS is insane. MPRIS is well-thought out. MPRIS is a standard for querying and controlling any media player without having to know the details of each player’s remote interface. MPRIS is now supported by the Now Playing data engine.

All of the above statements are true, to varying degrees.

It’s insane because it uses the same interface name (org.freedesktop.MediaPlayer) for three different interfaces (one for each of the objects /, /Player and /TrackList). This causes havoc with Qt’s D-Bus interface compiler. Luckily, just about everything I need is exported by the /Player part of the interface. Unfortunately, the only way to get the current track number out of Audacious is using the /TrackList object.

It’s well-thought out in most other respects. It has signals for information changes (something missing in Juk’s D-Bus interface). It is generally adaptable to the capabilities of most media players, without going overboard. It has a sane system of informing clients about the capabilities of the player’s interface (such as whether you can skip to the next track, for example), even if Audacious isn’t entirely honest about what is possible.

It’s a universal standard that allows clients to be player-agnostic. Or, at least, that’s the idea. Currently, I can only find one client supporting it: Audacious (although VLC 0.9.0 should include MPRIS support). And Audacious diverges from the standard in a couple of respects, most noticeably in the metadata returned for a track. It doesn’t include the tracknumber (which is optional, but it would be nice if it returned it when it made sense). It uses “length” for the length of the track in seconds, rather than “time”. And, outside the metadata, it claims every action is possible, even when it isn’t, such as stopping when nothing is playing.

The Now Playing applet support MPRIS players. Or, at least, it supports Audacious, which is the only one I’ve tested it with. And it doesn’t give a track number even then. But hey, it’s better than nothing, right? And other players should work “out of the box”, providing they don’t need any hacks like Audacious’ length/time metadata issue.

So: Juk and MPRIS players are supported. Next, I think I’ll steal XMMS support from the Kopete Now Listening plugin.

Incidentally, the player-querying code in the Now Playing engine should be general enough to use with other projects that need to get this information. One possible future change is to make them plugins that can be loaded by anyone who wants them.

PS: Is it me, or are there loads of media players that all seem exactly the same (WinAMP, Audacious, XMMS, Beep)?