You are not logged in.

#1 2021-12-26 10:09:01

TheStroyer
Member
Registered: 2018-08-28
Posts: 54

[SOLVED] Mpris always uses the first player found

I recently installed MPRIS together with the mpris support for MPD (mpd-mpris). However, I don't like the default behavior of always controlling the player that's found first, which is in my case always firefox. What I actually want is for MPRIS's play-pause command to control the player that is currently playing and keep a memory of which player it last controlled.
For example, if mpd is playing, play-pause should pause mpd. When I play-pause again, mpd should start playing again, unless some other player is currently playing.

I get that it's possible to achieve this with the --player argument of playerctl, but that will require non-trivial logic, so I was wondering if something like this already exists. I can't be the only one with this problem

Last edited by TheStroyer (2022-03-13 00:01:17)

Offline

#2 2021-12-26 12:17:16

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,657

Re: [SOLVED] Mpris always uses the first player found

Depends on the server, what are you already using as the MPRIS server provider?

Offline

#3 2021-12-26 13:08:24

Lilitu-Blackstar
Member
Registered: 2021-12-23
Posts: 51

Re: [SOLVED] Mpris always uses the first player found

you using mpdris2?  i found i needed that to interact with mpd and use a widget for a player in awesomewm from worrons config

Offline

#4 2022-01-05 20:48:22

TheStroyer
Member
Registered: 2018-08-28
Posts: 54

Re: [SOLVED] Mpris always uses the first player found

V1del wrote:

Depends on the server, what are you already using as the MPRIS server provider?

I'm not aware of MPRIS needing any server, nor do I see something about it on the wiki. I'm using playerctl as the controller and mpd-mpris as MPRIS implementation for MPD.

Lilitu-Blackstar wrote:

you using mpdris2?  i found i needed that to interact with mpd and use a widget for a player in awesomewm from worrons config

Yeah you need some sort of mpris provider for MPD, as it's not built in natively, but I'm using mpd-mpris, not mpdris2. Don't think it makes a difference, though, as it seems that playerctl is the one deciding which player to control.

Last edited by TheStroyer (2022-01-05 20:50:17)

Offline

#5 2022-03-13 00:00:57

TheStroyer
Member
Registered: 2018-08-28
Posts: 54

Re: [SOLVED] Mpris always uses the first player found

I figured out a solution that works.
From the playerctl github:

Playerctl comes with a service called playerctld that monitors the activity of media players in the background. If playerctld is running, Playerctl will act on players in order of their last activity. To start playerctld, add the following command to your system startup script:

     playerctld daemon

There is an open issue about adding support for prioritizing players that are currently playing, but this should already be pretty good.

Offline

Board footer

Powered by FluxBB