Skip to content

Keyboard media keys don't work with Relisten #107

Description

@jlevitt

When you have relisten playing in chrome pressing a hardware play/pause button on your keyboard doesn't pause the music. I asked Claude about this, and got this in response:

Two separate real issues on RelistenNet/gapless.js:

  1. In HYBRID mode the media session is attached to an element that never plays, so OS-level pause can't work by construction — declaring playbackState = 'playing' doesn't help, because Chrome trusts the element. The fix is to give Chrome a genuinely-playing element (e.g. route the Web Audio output through a MediaStreamAudioDestinationNode attached to a playing element).
  2. Queue.destroy() stops the actor but never nulls the four handlers it registered, leaving dead closures on navigator.mediaSession. Latent, not your bug today, but real.

Activity

  1. switz commented on Aug 26, 2026

    @switz
    Member

    Can you try out https://timber.relisten.net and see if you have the same issues there? It does work for me on firefox/mac.

  2. jlevitt commented on Aug 26, 2026

    @jlevitt
    Author

    @switz Hey, thanks for the quick response! Same behavior on timber. Also, let me amend the report a bit. If I pause the song using space or by clicking the pause button, then the media button does work to start it playing again. However, the media button does not allow me to pause it once playing. I'll also note that both work on other sites (youtube for example).

  3. switz commented on Sep 14, 2026

    @switz
    Member

    The fix is done in: RelistenNet/gapless.js#23

    We tested it and it worked, but it needs some more testing before it's fully confirmed. Please play with it here (https://timber.relisten.net) and let me know if it works or doesn't, it could use some deep testing. Thanks - will leave this open until we're sure its fixed.

    It is not fixed on the OG relisten.net - timber will replace it very shortly.

  4. jlevitt commented on Sep 14, 2026

    @jlevitt
    Author

    Just did a quick test and it seems to be working great! Nice job and thank you! I tested by itself and also switching back and forth between Spotify desktop app. It always resumed the last playing stream correctly. I'll keep using it and let you know if anything pops up.

  5. switz commented on Sep 14, 2026

    @switz
    Member

    Love hearing that, thanks for giving it a try. Let me know if it breaks in the future

  6. switz commented on Sep 14, 2026

    @switz
    Member

    also shoutout to @Thenlie for triaging and helping solve this issue, credit where its due 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions