Back on Windows, I was able to play/pause youtube videos within firefox using the media buttons on my keyboard. On Linux I am really missing this ability.

Is there any way I can send MPRIS commands to Firefox on Linux (gnome)? It doesn't have to work everywhere, youtube alone would be cool enough. I'm using Firefox 56.0.2.

I came across this but the install instructions are only for chrome and I can't get the firefox script to work as I'm not aware of how to create/get an extension/ID from the code on github.

Another answer here suggests the use of hotkeys, this is a nice idea but I would like to control youtube while Firefox is in the background too, so keyboard-shortcuts are out of the question.

All the solutions here are either outdated or for Chrome only.



just for you, you have to run step 1 everytime you open firefox until the addon is published. I'd publish it, but I didn't write the addon I only forked it.

  • This is so amazing of you. It works perfectly. Thank you. Honestly. Thank you. – confetti Aug 25 '18 at 23:28
  • Uhm, this is weird. It worked fine. Then I closed the current youtube video and opened another one, now it won't work anymore. dbus-monitor reveals this error: string "The name org.mpris.MediaPlayer2.totem was not provided by any .service files" - Totem is a video player on my system, but it isn't running. Do you know what could cause this? I feel like it might be unrelated because VLC doesn't work either anymore (same error) so I think I should open a new question. – confetti Aug 25 '18 at 23:36
  • @confetti yeah that's unrelated, try a restart – Aaahh Aug 26 '18 at 0:06

It's no longer necessary to use an extension these days. There's a standard D-Bus interface for media players: MPRIS, which is supported by recent Firefox versions. In Firefox versions before 81, it's still a bit experimental and needs to be enabled by toggling media.hardwaremediakeys.enabled in about:config; since Firefox 81 it's enabled by default and should work out of the box.

See this answer for more details.

  • Thank you so much for leaving this answer, the other solution stopped working for me over a year ago. Sadly I can not get myself to update Firefox past FF56 so I can't try it out. :/ – confetti May 7 '20 at 1:39
  • It's enabled by default since 81 support.mozilla.org/en-US/kb/…? – Avindra Goolcharan Oct 17 '20 at 18:10
  • 1
    @AvindraGoolcharan Thanks, I updated the answer to reflect that. – Tomáš Janoušek Oct 17 '20 at 18:45

I've found the extension web-media-controller the best implementation for this functionality. Just like the alternatives, it needs to run an executable in the background and interact with it through the native messaging protocol. This should be the superior choice since it's companion native messaging program - wmc-mpris is written in C and is much faster then it's Python based alternatives.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.