Skip to content

Next / previous track media keys don't work if navigated to album/playlist #6687

Open
@stephen304

Description

@stephen304

This issue respects the following points:

  • This issue is not already reported on GitHub (I've searched it).
  • I agree to follow Jellyfin's Code of Conduct.
  • This report addresses only a single issue; If you encounter multiple issues, kindly create separate reports for each one.

Describe the bug

When playing back music, I'm able to play/pause using my keyboard media Play/Pause button, but for some reason the next track / previous track buttons often do not work when I navigate to a playlist or album before playing it.

The Play/pause button always works for me, only the forward/back buttons are inconsistent depending on whether I navigated before playing (broken) or landed on a page and started playing without navigating (works fine).

Reproduction Steps

  1. Load jellyfin in Firefox
  2. Navigate to a playlist or album
  3. Click on the first song
  4. Press media key next track (doesn't work)
  5. Press media key play/pause (works)

For some reason, this DOES work:

  1. Load direct url of a specific album / playlist
  2. Click on the first song
  3. Press media key next - works fine

Also interestingly, this also DOES work:

  1. Load home page url
  2. Click play on album on homescreen without navigating
  3. Use next track media key - works fine

As well as:

  1. Load direct URL of playlists page
  2. Click play on playlist without navigating to playlist
  3. Use next track media key - works fine

Expected/Actual behaviour

It should go to next/previous song

Logs

No relevant logs are generated

Server version

10.10.6

Web version

10.10.6

Build version

10.10.6

Platform

Ubuntu 24.04.1 LTS with Docker

Browser

Firefox

Additional information

I investigated the event listener at

window.addEventListener('keydown', function (e) {

And overrode the main jellyfin bundle to add a console.log at the beginning of the event listener and noticed that it prints when Ctrl / Alt is pressed but not any of the media keys, which makes sense because it bails if hasMediaSession anyways. I have mediaSession in my navigator so I assume the media keys are handled through another code path which is causing the issue.

So in summary, it seems like the act of navigating to a playlist or album causes the prev/next media keys to stop working, but curiously the play/pause keeps working. If I play anything directly after landing on the page without navigating (by loading the direct URL of an album, playlist, or page that lets you play either without navigating eg home/playlists), the issue is also avoided.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions