Bug 380526 - Media playback buttons no longer work after locking and unlocking the screen (Regression in 5.10)
Summary: Media playback buttons no longer work after locking and unlocking the screen ...
Status: RESOLVED FIXED
Alias: None
Product: kscreenlocker
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 380868 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-04 00:45 UTC by Nate Graham
Modified: 2017-10-27 13:11 UTC (History)
22 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.10.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2017-06-04 00:45:02 UTC
Linux distro: openSUSE Tumbleweed
Plasma version 5.10

Just updated to KDE Plasma 5.10, from 5.9.5. Now, activating the screen locker disables my media keys. This is a significant regression, and probably related to the work done to make media playback controls appear on the lock screen.

Steps to reproduce
1. Open any MPRIS-compatible music player (tried Amarok and Lollypop)
2. Start playing a song
3. Use your keyboard's built-in media playback keys and verify that they work
4. Lock the screen using any method (suspend, manual locking- makes no difference)
5. Unlock the screen
6. Use your keyboard's media keys again

Expected results
The media keys should still work.

Actual results:
The Media keys no longer work.
Comment 1 Nate Graham 2017-06-04 01:19:22 UTC
Once this problem has manifested, if you lock the screen again, the media playback keys work from the lock screen itself! So it seems like whatever is grabbing control of the media keys for the lock screen isn't giving up that control once the lock screen goes away.
Comment 2 Nate Graham 2017-06-04 01:42:35 UTC
Not much of a workaround, but restarting X restores proper control of the media playback keys.
Comment 3 flyos 2017-06-04 01:58:54 UTC
I can confirm this. However, I'm using custom shortcuts (e.g. Meta+S for pause) and they are not working on the lock screen (can't test Media Control keys as I don't have them).
Comment 4 pmargeti34 2017-06-04 08:41:57 UTC
Confirming 
OS:Manjaro
KDE 5.10 
Media keys not working after screen lock
Comment 5 Szymon Łągiewka 2017-06-04 10:18:59 UTC
Same for me. Media keys are working before the lock, during the lock but not after unlock. Another lock - keys are available again on lock screen, but still not after unlock.

Arch Linux, Plasma 5.10, Qt 5.8.
Comment 6 Kai Uwe Broulik 2017-06-04 15:02:53 UTC
Does it work again if you restart plasmashell after unlocking the screen? It should then re-claim the keys. I'll investigate.
Comment 7 Nate Graham 2017-06-04 15:05:37 UTC
Yes, restarting plasmashell restores proper functionality.

So we have another, better workaround: killall plasmashell; plasmashell > /dev/null 2>&1 & disown
Comment 8 retired 2017-06-04 18:06:09 UTC
I'd like to chime in.
Pause shortcut is not working on lockscreen for me.

If it is unrelated then I can create new bug report.
Comment 9 Nate Graham 2017-06-04 19:55:12 UTC
Now that you mention it, Piotr, I see that as well. Only the forward and back hardware buttons work on the lock screen. The play/pause button seems to very rapidly do play and pause, restoring the music to whatever status it already had.
Comment 10 Szymon Łągiewka 2017-06-04 20:18:49 UTC
Ok, so we have some weird issues here.

What you have pointed I've applied to two applications VLC and Spotify.

For Spotify right now (during lock screen):
Next/Previous buttons cause skipping not one but two tracks. Pause/Play works normal.

For VLC:
Next/Previous buttons work, Play/Pause does nothing. I can't tell if it's doubled.

This is particulary interesting, because I think Spotify normally behaves like this: Every event is doubled. Double-skips tracks and pauses-unpauses track instead of pausing. I don't know if it is Spotify's issue or Plasma's, but when I'd recently thought that this is no longer happening - here we go.

So in essence, looks like Next/Previous on lock screen behave as they should, but play/pause is doubled?
Comment 11 Szymon Łągiewka 2017-06-04 20:20:46 UTC
Oh, and restarting plasmashell does not seem to work for me. Neither with kquit/kstart nor killall and executing plasmashell.
Comment 12 Kai Uwe Broulik 2017-06-04 21:49:17 UTC
Patch: https://phabricator.kde.org/D6095
Comment 13 David Edmundson 2017-06-04 21:51:14 UTC
To write up what's hpapening.

The lockscreen loads the MPRIS dataengine, that engine registers the global shortcuts. (see multiplexer.cpp)

One component can't steal grabs from another, but because the dataengine uses a brand new action collection with a branch new component "Media Controls" it's not technically stealing the controls, simply re-registering a second copy of the same component. Doing that is a bit weird.

Rather than having code for the applet to grab the shortcuts again the moreobvious solution is to simply not register new shortcuts from the lockscreen. 

IMHO we should move the shortcut handling from the dataengine to something else  which our MPRIS applet can load. Dataengines should be read only data fetchers; therefore not doing this.
Comment 14 retired 2017-06-04 22:17:02 UTC
I've tested your patch.
My problem of pause/play not working on lockscreen is gone. Or I'm just lucky.
Comment 15 David Edmundson 2017-06-05 12:37:51 UTC
Git commit 7bd909fa3a4f70bf4c03c43b025f7ed65c2e5b5c by David Edmundson.
Committed on 05/06/2017 at 12:37.
Pushed by davidedmundson into branch 'Plasma/5.10'.

Only enable MPRIS global shortcuts on demand

Summary:
The lockscreen uses the MPRIS dataengine. This leads to two applications
registring the service using the same component name which leads to the
shortcuts not working when the lock screen closes.

We want to have the applet register the shortcuts, but not every
dataengine user.

Ideally this shouldn't be in the dataengine either because DataEngines
are read only. This moves the logic to the service which is writable and
registers the shortcuts for the multiplexer there when requested from
the applet.
FIXED-IN: 5.10.1

Test Plan:
Opened media player.
Used play/pause shortcut. (the only one my keyboard has)

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6100

M  +4    -0    applets/mediacontroller/contents/ui/main.qml
M  +58   -0    dataengines/mpris2/multiplexedservice.cpp
M  +5    -0    dataengines/mpris2/multiplexedservice.h
M  +0    -49   dataengines/mpris2/multiplexer.cpp

https://commits.kde.org/plasma-workspace/7bd909fa3a4f70bf4c03c43b025f7ed65c2e5b5c
Comment 16 Kai Uwe Broulik 2017-06-06 04:08:24 UTC
*** Bug 380868 has been marked as a duplicate of this bug. ***
Comment 17 Kai Uwe Broulik 2017-06-06 04:09:11 UTC
*** Bug 380509 has been marked as a duplicate of this bug. ***
Comment 18 Kai Uwe Broulik 2017-06-06 08:03:59 UTC
*** Bug 380877 has been marked as a duplicate of this bug. ***
Comment 19 Stefan L 2017-06-20 19:30:07 UTC
This does not seem to be fixed for me.

OS: KDE neon 5.10
Plasma: 5.10.2

I'm not quite sure about what makes the mediakeys stop working, but at the moment they are not working. Restarting plasmashell does not fix the problem.
On the lockscreen everything is working as expected (including the playpause button). Any logs/debug info that I could provide?
Comment 20 Nate Graham 2017-06-20 20:21:41 UTC
The fix should have made it into 5.10.1, so if you're still using 5.10, it won't be fixed yet for you.
Comment 21 Stefan L 2017-06-20 21:34:51 UTC
I'm using Plasma 5.10.2
Comment 22 confused 2017-06-27 21:51:39 UTC
Same for me. Media keys are not working, if I assign them to the actions of "Media Controller". Though they work, if I assign them to e.g. Amarok.
Looks like "Media Controller" hasn't "subscribed" those keys properly, because nothing shows up at dbus-monitor.
I'm using Plasma 5.10.3 (also had this issue with .2).
Comment 23 confused 2017-06-27 21:59:46 UTC
Just noticed that it's not just about the media keys. Doesn't matter which keys I assign to "Media Controller" actions, it doesn't work at all.
Let me know, if I can help with more information :)
Comment 24 Gulli 2017-10-27 12:06:49 UTC
I have the same issue using Cantata 2.0.1 in Plasma 5.10.5 on Fedora 25, Media Controller shortcuts do nothing at all, even after restart.
Comment 25 Nate Graham 2017-10-27 13:11:43 UTC
Kai, is there still a bug here?