Bug 377959 - Media Controller hotkeys not working in chrome
Summary: Media Controller hotkeys not working in chrome
Status: REPORTED
Alias: None
Product: plasma-mediacenter
Classification: Unmaintained
Component: MediaController (other bugs)
Version First Reported In: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Sinny Kumari
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-22 21:48 UTC by qwad1000
Modified: 2020-10-04 14:40 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description qwad1000 2017-03-22 21:48:51 UTC
Play-pause/next/previous keys are not registered in chrome while they are set as keys for MediaController.

Steps to reproduce:
0) Be sure that Media Controller hotkeys are set (Global shortcuts > Media Controller)
1) Go to chrome://extensions
2) Scroll down and open "Keyboard shortcuts".
3) Try to set any shortcut with same (Play/Next/Previous) keys.
Actual results:
Nothing happens. Shortcut is not set. Keypresses just not appears for chrome.
Expected results:
Shortcut is set and usable.

I'm using KDE Neon User edition now (5.9.3-5.9.4 while I'm writing this).

Additional information:
1) Expected results are achievable on Kubuntu 16.04.
2) Try first set Media Controller shortcut (e.g. Play) to 'None' in Global Shortcuts. Then the shortcut would be easily registered in chrome. Moreover - when you set shortcut back in Global Shortcuts chrome is still able to work with it. But after system reboot the problem renews.
3) I've used Yandex.Music chrome extension and vk.com music library with those hotkeys (in case you need this info).
Comment 1 Oded Arbel 2020-10-04 14:40:35 UTC
This is still an issue with Plasma 5.20. It is caused by the fact that the media controller consume the key press event using its global shortcuts so applications don't see them - I have the same problem with Kodi under Plasma - media buttons just don't work because the media controller eats them and converts them to MPRIS commands ( https://specifications.freedesktop.org/mpris-spec ).

Normally it is not an issue with browser applications as media applications are supposed to use the `MediaSession` API (https://developer.mozilla.org/en-US/docs/Web/API/MediaSession) to receive media control events from the operating system and Plasma integrates well with both Chrome and Firefox to forward MPRIS commands to the `MediaSession` API (this also allows scripting, KDE Connect, Plasma media control desktop widgets, etc).

I'm not sure this is something that can be fixed, or we even want to fix - the MPRIS setup is the "right thing" for most users and provides excellent experience out of the box with many many applications.

The workaround you discovered - disabling the media controller global shortcuts - is the correct one. The fact that the application still received the media key press events after you disabled and re-enabled the media controller global shortcuts *is* a bug and I believe it is already fixed in Plasma 5.20 (I have not been able to reproduce it).