MPRIS players are identified by display name
Closed, ResolvedPublic

Description

So when you have two players open with the same name, you can only control one.

jeanv added a subscriber: jeanv.Jul 25 2017, 4:44 PM

I tried to take a look at this, even though I didn't know anything about DBus.

I launched two instances of VLC, and I indeed can only control the first one. If I stop the first instance, I can then control the second one normally.

Rather than the problem being that they have the same name, it seems to me that since they are the same service, we don't get to call addPlayer(). When starting the second instance, several serviceOwnerChange events are triggered but none with the service name org.mpris.MediaPlayer2.vlc so they are all ignored.

Makes sense: If two players are running, they should have different dbus names or there is no way to control both.

Can you check if this also happens with the volume plasmoid, then? Maybe there is a workaround that we don't know.

And also I still think (without lookin at the code, so I can't confirm) that even if two players had different dbus paths, we wouldn't be able to distinguish them if they had the same name because we use the name as unique ID. So that might be worth fixing... (If it's the case).

jeanv added a comment.Jul 26 2017, 4:33 PM

The volume plasmoid works correctly: both players are visible.

And you're correct, the name is used to identify them in playerList.

So it looks like we have several things to fix!

jeanv added a comment.EditedJul 27 2017, 6:54 AM

I'll see what I can do, although I'd rather not claim the task since I don't know anything about DBus (yet, it's a good excuse to learn) and might get stuck.

Where can I find the volume plasmoid's source? in Plasma?

jeanv added a comment.EditedJul 29 2017, 8:53 AM

Here's what I found:
Concerning the naming of the service, having a unique name per instance is actually part of D-Bus's specifications. It's supposed to be implemented in VLC (see the source here, line 201) but there was a bug that only got fixed june 18 and since I'm on KDE Neon, I have an older version installed. Indeed if I check the D-Bus connections in Manjaro with two instances of VLC, I get two connections.

Banshee doesn't seem to implement the spec properly either, since I only get one service with two instances. I don't know how common that is or what we can do about it.
EDIT: I'm actually not sure about Banshee because it doesn't support multiple instances so I had to launch the second one as root, which might mess things up.

albertvaka closed this task as Resolved.Aug 2 2017, 1:44 PM