I’m trying to control media (playing in Firefox, not Snap / Flatpak, Plasma Browser Integration is installed) using the system tray. Play, pause and seek work fine, but previous and next buttons are disabled.
Strangely enough, KDE Connect does let me use the prev / next buttons on my phone. This makes me think that there exists at least partial support for skipping media in the browser.
Does anyone have an idea how to make the tray buttons work? Any help would be appreciated.
Check if Media Control is enabled in Plasma extension’s preferences:
Thank you for your reply. Yes, it is enabled.
I just did some experimenting. When playing media on YouTube, the prev / next buttons actually do appear, but only if there is a play queue and after I watch the first video in it. Is it the same for you?
I would also like to get other sites working (primarily Jellyfin).
I can’t help wondering how much of it is app specific? I have never run jellyfin, so I am not familiar with it, but I see that it is built on the .NET Frameworks, so I am not sure if you could get it working with this feature or not. You may have to ask them if it is possible, or can they add the feature.
I have done some research on the MPRIS protocol and experimented with
playerctl. It seems like two players are being reported: Firefox and Plasma Browser Integration.
- The Firefox player supports the prev / next buttons (that’s why I was able to use KDE Connect), but does not provide metadata. It isn’t shown in the tray.
- The PBI player provides metadata (track name, album, image, cover art etc) but doesn’t support the prev / next commands. As such, the buttons are disabled.
So @WilsonEPhillips it seems like you’re right: for some reason PBI thinks that skipping is not supported in Jellyfin (and YouTube in most cases). I will be having a look at the source code to find out why.
Update: I did some debugging on the PBI extension to find out how it interacts with Jellyfin. It hijacks the
navigator.mediaSession.setActionHandler method to keep track of the different player callbacks (including
nexttrack). Jellyfin does set these callbacks on start. In fact, if I reload the page and play something without clicking any links, the tray buttons and media keys work just fine.
Problems arise when I navigate between pages. Jellyfin uses SPA-style navigation, so there are no page reloads and the media keeps playing. However, it also emits the
pagehide event on navigation, which PBI interprets as if the player was closed (MPRIS gone). This seems to invalidate callbacks, therefore it’s assumed that prev / next commands are unsupported.
As for YouTube, the buttons are disabled simply because it does not attach the needed callbacks unless a mix or similar is playing.
Since we’re dealing with an app specific problem, I opened an issue in the Jellyfin repo: Reasoning behind page events · Issue #5087 · jellyfin/jellyfin-web · GitHub. I will also try out
jellyfin-vue (an alternative frontend) and update this thread.
Jellyfin Vue doesn’t have the described issue.