Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media playback keys no longer detected #1546

Open
3 tasks done
Cre8or opened this issue Sep 14, 2024 · 12 comments
Open
3 tasks done

Media playback keys no longer detected #1546

Cre8or opened this issue Sep 14, 2024 · 12 comments

Comments

@Cre8or
Copy link

Cre8or commented Sep 14, 2024

  • I have checked the FAQ for answers.
  • I have checked the Changelog that the issue is not already fixed.
  • I believe this issue is a bug, and not a general technical issue, question or feature requests that can be discussed on the forum.

Describe the bug
I'm vaguely paraphrasing, but it seems that a KDE update has changed how events related to media controls are dispatched, and Strawberry is not aware of this change (yet). The behaviour described in this issue over at the KDE bug tracker closely matches my issue:

  • Strawberry can be paused via media shortcuts, but not resumed
  • Strawberry no longer skips songs in the playlist via media shortcuts ("previous"/"next")

None of these problems seem to occur when I start Strawberry without any additional file arguments (think "double-clicking" the desktop shortcut), and then play music. The issue only occurs when I double-click a music file, which KDE then opens via Strawberry (thus passing the file path as argument).

My Strawberry/KDE shortcuts are set to default keybindings.

To Reproduce

  • Ensure Strawberry is not open
  • Open a media file with Strawberry (right click -> open with, or any similar method in your distro, so long as Strawberry opens the file immediately on startup)
  • Start the first song (if it isn't playing yet)
  • Use the system's "Media Play" shortcut key to pause the currently playing song
  • Use that same key again to resume the song
  • Notice that the song has not resumed
  • Manually resume the song via the Strawberry player's UI
  • Use the system's "Next track" shortcut key to jump to the next song
  • Notice that the playlist hasn't skipped to the next song, and is still playing the first song
  • Close Strawberry, and manually reopen it without any file arguments (e.g. desktop shortcut)
  • Repeat the above steps and notice the media keys now work again

Expected behavior
The listed media buttons should work irrespective of how Strawberry was opened.

Screenshots:
image

System Information:

  • Operating system: Arch Linux 6.10.9-arch1-2 / KDE Plasma 6.1.5
  • Strawberry Version: 1.1.2

Additional context
I suspect there is a problem with how Strawberry detects keypresses, as if I rebind the media shortcuts to miscellaneous keyboard buttons (e.g. J / H / K / etc.), I can use these buttons as expected. Specifically the media buttons seem to be the issue. In fact, when I attempt to rebind these keyboard buttons back to the proper media buttons, the window prompting me for a keybind does not register anything, and remains empty:
image

See https://bugs.kde.org/show_bug.cgi?id=490569

@jonaski
Copy link
Member

jonaski commented Sep 14, 2024

I've tested global shortscuts on KDE using KGlobalAccel, 3 different keyboard, it's working fine here. KDE Plasma 6.1.5 and KDE Frameworks 6.5.0. I didn't change anything that should affect global shortcuts in version 1.1.2 either.
I suspect this is something to do with the KDE configuration.

@Cre8or
Copy link
Author

Cre8or commented Sep 14, 2024

Bit ashamed to admit it, but after a reboot, the issue is now gone. I don't know why the thought hadn't crossed my mind sooner... 😬

Sorry for wasting your time!

@Cre8or Cre8or closed this as completed Sep 14, 2024
@Cre8or
Copy link
Author

Cre8or commented Sep 18, 2024

Hmm, seems like the issue is back, and I can narrow it down to a reproducible error - even across restarts.

When I open Strawberry without passing a media file as argument, the media keys work as expected. I can then add music to it (drag&drop, loading a playlist, etc.) and use it as expected.

If I however open Strawberry by double-clicking a music file (thus launching Strawberry with a file argument), the media key issues as originally described appear. So it effectively comes down to how I launch the application.

I have done a system update and am still on Strawberry 1.1.2 at this time.

EDIT 1: It seems like this issue only occurs on KDE. I originally thought it might be caused by the .desktop file, but now I'm not so sure anymore...

EDIT 2: The same behaviour/issue is occuring with VLC, with the same behaviour regarding opening files! Sounds like it's related to the KDE media playback tray widget. There's an ongoing discussion about it over at the KDE bug tracker.

@Cre8or
Copy link
Author

Cre8or commented Sep 22, 2024

I'm reopening this issue as the problem still persists in Strawberry v1.1.3.

@Cre8or Cre8or reopened this Sep 22, 2024
@CrimsonKeys
Copy link

I am also having the same issue in Fedora 41 KDE plasma 6.2.4 strawberry v1.2.3. It seems that it is also repeatable on my system only when opening a file directly not when playing after manually opening Strawberry. Like CreBor it also affects VLC, it does not however affect MPV.

@kyeastmood
Copy link

kyeastmood commented Jan 4, 2025

I have the same issue with Strawberry 1.2.3, the media buttons have never worked for me in Strawberry, though (IIRC). The media play/pause buttons are not recognized when I press them in the "Global shortcuts" settings page. In Clementine they work correctly. My system is current Debian Testing with KDE 6.

@jonaski
Copy link
Member

jonaski commented Jan 4, 2025

I can't reproduce this, works here even when opening a file with strawberry from right click menu in dolphin.

@kyeastmood
Copy link

kyeastmood commented Jan 5, 2025

I found the issue. In the KDE Shortcuts page there was a lower-case "strawberry" entry in the "System Services" section. I'm not sure how it was added there. Both Amarok and Clementine have entries in the "Applications" section instead. So I've also added an entry for Strawberry in the "Applications" section and now play/pause buttons work (I can assign them now both from KDE shortcuts settings and from Strawberry settings).
kde-shortcuts

@jonaski
Copy link
Member

jonaski commented Jan 7, 2025

Thanks @kyeastmood

There was a name mismatch, strawberry with lowercase was used for KGlobalAccel, while Strawberry with capitalized S was used for MPRIS2, maybe that could explain some of the issues. I've fixed this now, it should now appear only with Strawberry with captilized S, delete the other entry if it's still there. If possible try with the latest code from git master, or use the latest from https://builds.strawberrymusicplayer.org/

@jonaski
Copy link
Member

jonaski commented Jan 7, 2025

I don't know why it appeared in the "System services" section, but it seems to appear correctly under Applications when testing here now after I changed the naming.

@CrimsonKeys
Copy link

Cheers for the responses I've tried the latest build and It appears to still not be working on my system, I have done further testing and it seems to work fine if I manually set the shortcuts for Strawberry via system settings and it is only when the KDE media controller is trying to control it that it fails. Pause and stop both work however play, next and previous don't work when KDE media controller is being used. As described before though this only seems to be an issue when Strawberry is launched by opening a file and not if it is run manually or if already running then a file is opened.

@kyeastmood
Copy link

kyeastmood commented Jan 9, 2025

@jonaski I tried to remove both entries (strawberry and Strawberry), but they both always re-appear after I launch the System Settings. But it doesn't seem to be an issue.

I've compiled Strawberry from the main branch and the Play/Pause buttons work but it seems the new Strawberry created its own entry (upper-case) in System Settings so I had 3 entries. But now I could also remove the manually added entry.

The most-recent build of Strawberry (from the main branch) works both with the entry it created and with the entry I manually added (after I reassign the shortcuts). The distribution-provided Strawberry only works with the entry I added.

So overall the problem for me seems to be fixed, the entry is automatically added to KDE's shortcuts and the most recent version improves overall handling of media buttons.

The remaining issues seem to be more likely related to KDE's media playback control.

EDIT:
The KDE's media controller doesn't seem to cause any problems in my case: I can use it to control Strawberry when I start it from the Start menu and when I open a file in Dolphin. It also doesn't seem to interfere with play/pause media buttons. However I don't have the previous/next buttons on my keyboard so I can't tell anything about them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants