MPRIS: Media keys (play, pause etc.) get confused and stop working

Questions about codecs, DVD playback, web plugins...
Forum rules
Before you post please read how to get help
User avatar
MrEen
Level 21
Level 21
Posts: 13054
Joined: Mon Jun 12, 2017 8:39 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by MrEen »

Hi The Bright Side.

You're one of the Cinnamon users I was hoping to find for this. I was hoping this command might work for you to restore the MM keys:

Code: Select all

killall csd-media-keys && csd-media-keys
That is based on this part of your output:

Code: Select all

Client #2
	Driver: protocol-native.c
	Owner Module: 12
	Properties:
		application.name = "Cinnamon Volume Control Media Keys"
		native-protocol.peer = "UNIX socket client"
		native-protocol.version = "32"
		application.id = "org.gnome.VolumeControl"
		application.icon_name = "multimedia-volume-control"
		application.version = "4.4.1"
		application.process.id = "1973"
		application.process.user = "thebrightside"
		application.process.host = "SATANSGERBIL"
		application.process.binary = "csd-media-keys"
		application.language = "en_US.UTF-8"
		window.x11.display = ":0"
		application.process.machine_id = "f3d85c83fd6e458aba76dbf56f683032"
		application.process.session_id = "c2"
What I have no idea about is if you also need to restart the apps that make use of csd-media-keys, Spotify in this case. Play with that and see if you can get a working solution.

Come to think of it, you might even need to restart pulseaudio (pulseaudio -k should do it) as I just don't know how these things are tied together.

Let us know if you find something that works.
inedibly_indelible
Level 1
Level 1
Posts: 20
Joined: Wed Apr 01, 2015 6:27 am

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by inedibly_indelible »

MrEen wrote:
Thu Mar 05, 2020 9:47 pm
inedibly_indelible, I think this might work for you. I guessed at the wrong thing I'm thinking with this:

Code: Select all

killall mate-volume-control-applet && mate-volume-control-applet
Try instead:

Code: Select all

killall mate-settings-daemon && mate-settings-daemon
This was a known issue with gnome-settings-daemon I believe, and mate-settings-daemon is a fork of it I'm pretty sure. I could be wrong, and it may have been an issue only with gsd-media-keys which the gsd stands for gnome-settings-daemon. I was hoping with the ps aux | grep media we might see something like msd-media-keys which should be the correct thing to kill and restart if it does exist.

Well, I typed out all that, then look what I found: https://github.com/mate-desktop/mate-se ... media-keys

Maybe for your case, the plugin is dying when the keys stop working and we just need to restart it. I can't tell from quickly looking through the source code, but my guess would be running this in the terminal.:

Code: Select all

msd-media-keys
EDIT: Well damn. Now I found this as well: https://github.com/mate-desktop/mate-se ... gins/mpris

I'm not sure which thing is supposed to be in use.

Code: Select all

killall mate-settings-daemon && mate-settings-daemon
fixed it! Media keys seem to be working flawlessly now. Although when I try to run it in the background with

Code: Select all

killall mate-settings-daemon && mate-settings-daemon &
, it stops working. Oh well, as long as they keys are working!

Thanks for your help!
User avatar
MrEen
Level 21
Level 21
Posts: 13054
Joined: Mon Jun 12, 2017 8:39 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by MrEen »

Fantastic! I'm glad that worked.

As I guess the issue will present itself again, you might want to consider making a keyboard shortcut or a launcher for that command. That might prevent the need to try to send it to the background.
The Bright Side
Level 2
Level 2
Posts: 99
Joined: Thu Jul 12, 2018 3:09 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by The Bright Side »

MrEen wrote:
Sat Mar 07, 2020 2:07 pm
Hi The Bright Side.

You're one of the Cinnamon users I was hoping to find for this. I was hoping this command might work for you to restore the MM keys:

Code: Select all

killall csd-media-keys && csd-media-keys
That is based on this part of your output:

Code: Select all

Client #2
	Driver: protocol-native.c
	Owner Module: 12
	Properties:
		application.name = "Cinnamon Volume Control Media Keys"
		native-protocol.peer = "UNIX socket client"
		native-protocol.version = "32"
		application.id = "org.gnome.VolumeControl"
		application.icon_name = "multimedia-volume-control"
		application.version = "4.4.1"
		application.process.id = "1973"
		application.process.user = "thebrightside"
		application.process.host = "SATANSGERBIL"
		application.process.binary = "csd-media-keys"
		application.language = "en_US.UTF-8"
		window.x11.display = ":0"
		application.process.machine_id = "f3d85c83fd6e458aba76dbf56f683032"
		application.process.session_id = "c2"
What I have no idea about is if you also need to restart the apps that make use of csd-media-keys, Spotify in this case. Play with that and see if you can get a working solution.

Come to think of it, you might even need to restart pulseaudio (pulseaudio -k should do it) as I just don't know how these things are tied together.

Let us know if you find something that works.
Hello MrEen! I'm experiencing the issue again right now. I was watching YouTube videos earlier and still have Opera open (but no tab with YouTube). I have since launched VLC and am listening to some multichannel music when I just noticed the media keys don't work.

I tried closing VLC and running the command you suggested above in the terminal. It stops mid-execution:

Code: Select all

~$ killall csd-media-keys && csd-media-keys

(csd-media-keys:21047): Gtk-WARNING **: 10:39:41.952: Theme parsing error: gtk.css:2:15: not a number

(csd-media-keys:21047): media-keys-plugin-WARNING **: 10:39:41.987: Unable to register client: GDBus.Error:org.gnome.SessionManager.AlreadyRegistered: Unable to register client

The command prompt never comes back, it just stays there with a blinking cursor.

I re-launched VLC with the terminal still open. Music plays, but the media keys still don't work.

I closed VLC, force-closed the terminal and re-launched VLC. Same result.

I'm gonna be using this computer for the next few hours and don't plan on rebooting. Let me know if there's any log or further info I can provide while my PC is in this state.
User avatar
MrEen
Level 21
Level 21
Posts: 13054
Joined: Mon Jun 12, 2017 8:39 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by MrEen »

I'm afraid I'm at a loss right now.

Based on inedibly_indelible's success above, it looks like it's the settings daemon we need to kill and restart. I don't know if this is valid, but try:

Code: Select all

killall cinnamon-settings-daemon && cinnamon-settings-daemon
EDIT: Looks like it is valid, so I'm hoping it work to reset the media keys for you.
The Bright Side
Level 2
Level 2
Posts: 99
Joined: Thu Jul 12, 2018 3:09 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by The Bright Side »

Hmm, that doesn't seem to work.

Code: Select all

~$ killall cinnamon-settings-daemon && cinnamon-settings-daemon
cinnamon-settings-daemon: no process found

Code: Select all

~$ cinnamon-settings-daemon
cinnamon-settings-daemon: command not found
User avatar
MrEen
Level 21
Level 21
Posts: 13054
Joined: Mon Jun 12, 2017 8:39 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by MrEen »

Ahh crap! I know the damn thing exists, but I guess we need another way to start it. I'll see if I can figure it out, but I have to get ready for work, so it won't be in time for testing for several hours.
The Bright Side
Level 2
Level 2
Posts: 99
Joined: Thu Jul 12, 2018 3:09 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by The Bright Side »

Thanks, and no worries/no rush! It's really not a huge problem. I'll be here for another few hours.
User avatar
MrEen
Level 21
Level 21
Posts: 13054
Joined: Mon Jun 12, 2017 8:39 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by MrEen »

Ugh! Crappy day.

Let's make sure it's installed with apt policy cinnamon-settings-daemon, while I try to find what command should restart it. Starting to look for it now.
User avatar
MrEen
Level 21
Level 21
Posts: 13054
Joined: Mon Jun 12, 2017 8:39 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by MrEen »

Looks like cinnamon-session will restart if cinnamon-settings-daemon crashes, so probably a good thing killall cinnamon-settings-daemon didn't work. I imagine that wouldn't be a good thing. Although, it does appear it should start with cinnamon-settings-daemon, and we could append the --debug flag to the end, so I don't know why you got what you did. I'm guessing that starts the org.cinnamon.SettingsDaemon process only when the process isn't already running.

Here's something that might help: gsettings list-children org.cinnamon.settings-daemon.plugins

I'm starting to think it's going to be a gsettings command that is needed for Cinnamon users based on this error you received:

Code: Select all

(csd-media-keys:21047): media-keys-plugin-WARNING **: 10:39:41.987: Unable to register client: GDBus.Error:org.gnome.SessionManager.AlreadyRegistered: Unable to register client
Unfortunately, I have practically zero experience with gsettings, but I'm trying to find something useful.
User avatar
MrEen
Level 21
Level 21
Posts: 13054
Joined: Mon Jun 12, 2017 8:39 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by MrEen »

Actually, next time, or now if it's still not working, try:

Code: Select all

killall csd-media-keys
Wait a few seconds, then again:

Code: Select all

killall csd-media-keys
I'm thinking this will generate the same errors again, but until I know better, then try:

Code: Select all

csd-media-keys
That's based on this from here:
TESTING
To test a plugin:

Kill the running CSD plugin
Build the project
Run the built plugin in verbose mode
For instance:

killall csd-sound (you might have to kill it twice, if CSM tries to restart it)
dpkg-buildpackage
plugins/sound/csd-sound --verbose
The Bright Side
Level 2
Level 2
Posts: 99
Joined: Thu Jul 12, 2018 3:09 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by The Bright Side »

Thanks so much for all your efforts! I've since restarted my PC, so I'll try your new suggestions as soon as the issue occurs for me again.
glitchsys
Level 1
Level 1
Posts: 5
Joined: Fri Jul 20, 2012 10:36 am

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by glitchsys »

Ok so I was looking at this old post: https://fabianlee.org/2016/05/25/ubuntu ... r-spotify/ and I decided to try it, on Linux Mint 20 Cinnamon. I created a custom shortcut that executed 'dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause' which when I run the command manually, works on Spotify.
So I then mapped the Play/Pause button on my keyboard to this custom shortcut.

I hit the Play/Pause button on the keyboard and... nothing. Spotify keeps playing.

So I know the command works, obvious the issue is that the Play/Pause button on the keyboard, at least for me, is not triggering the custom command or even the default/built-in Play/Pause shortcut. I know the button works because I can press it in order to map the key. But then, afterwards, it's like the key does nothing.
User avatar
MrEen
Level 21
Level 21
Posts: 13054
Joined: Mon Jun 12, 2017 8:39 pm

Re: MPRIS: Media keys (play, pause etc.) get confused and stop working

Post by MrEen »

Hi glitchsys,

I suspect the interpreter for the keyboard shortcut isn't able to handle what you're asking of it. Try changing the command to this:

Code: Select all

bash -c "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"
Post Reply

Return to “Sound, Multimedia, & Codecs”