Next/previous track media control support (Chrome)

Have the ability to use the chrome browser media controller to quickly select next/previous track, as currently only play/pause are supported.

+1

This also prevents the “next” and “previous” keyboard media keys from working with the web app whereas the “play/pause” key works.

Wanted to chime in and provide two working examples for comparison to Plex.
image
Both spotify and youtube music support play controls via chrome’s media control menu, which also supports media keys (play/pause, next, previous) on my keyboard.

I believe many other streaming media websites support this as well. I am not sure if this is in some way due to chrome itself having support for these services or if the services have put something into their website code to allow compatibility. If it’s the later it would be great if plex could do this as well.

This is the closest thing i can find to any documentation from google about how to have your media player supported.


The contents make it look like they are talking about android but i believe they are actually showing chrome on android which i imagine would work the same on desktop.

Ok if you open the chrome developer console and paste this in you get pretty much what we’re wanting.

Edit: Moved code to https://github.com/nemchik/plex-web-mediaSession and added support for other media types (movies, music, and tv). Just copy the javascript to a console to run it.

but I wasn’t able to get the album art and fancy styling.

documentation https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/metadata

Just wanted to update about https://github.com/nemchik/plex-web-mediaSession i have added code to observe changes to the playing media, so you can paste the js code into the console once after loading the page and it’ll continue to work until you reload the page. If Plex were to take that exact code and ship it the only thing that would be missing would be album art.

I’m just reverse engineering this though, and I feel like Plex will be able to do a better job making a proper script to ship. As such I have included comments all over the code in my repo advising where I think Plex could probably do it better than what I came up with.

2 Likes

@ilikepie717 could you change the topic to include firefox and edge as well, you can see the compatibility here https://developer.mozilla.org/en-US/docs/Web/API/Media_Session_API

It seems to now be implemented, thanks!

Nice. It’s in the changelog since November!

Off to go try it out!

2021 clean-up: implemented