Add global media support for web extension
Categories
(WebExtensions :: General, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: mattw, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(2 obsolete files)
No description provided.
Reporter | ||
Updated•8 years ago
|
Reporter | ||
Updated•8 years ago
|
Updated•8 years ago
|
Comment 1•7 years ago
|
||
While this is pending, could someone fix the compatiblity listing @ https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/commands#Media_keys ? It's not accurate for Firefox. I tried adding the compatibility table but I'm pretty lost on how the template engine works.
Comment 2•7 years ago
|
||
Is this correct now? https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/commands#Chrome_incompatibilities_2 > I'm pretty lost on how the template engine works. You just have to edit this: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities#commands, then shift-refresh this: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/commands to pick up the changes.
Comment 3•7 years ago
|
||
Yes, it's fixed now and thank you for showing me how to do that myself in the future!
Comment 6•7 years ago
|
||
Any update on this? It has been open for 2 years and it is going to break some Add-ons starting with Firefox 57: http://addons.mozilla.org/firefox/addon/media-keys
Comment hidden (off-topic) |
Comment hidden (off-topic) |
Comment 9•6 years ago
|
||
Until this issue is fixed by Mozilla, people can use Chromium [1] with the Streamkeys extension [2]. [1] http://github.com/henrypp/chromium [2] http://www.streamkeys.com
Comment 10•6 years ago
|
||
Actually, it appears that media keys *are working*, just not globally. Example "manifest.json": { "name": "wh", "version": "1.0.0", "manifest_version": 2, "background": { "scripts": ["xr.js"] }, "commands": { "ya": { "suggested_key": { "default": "MediaPlayPause" } } } } and "xr.js": browser.commands.onCommand.addListener( zu => console.log(zu) ); Until global is implemented: http://bugzilla.mozilla.org/show_bug.cgi?id=1411795 the above will only work if the browser has focus.
Comment 11•6 years ago
|
||
Media keys are still not working on macOS, even if Firefox has focus. Apparently, media keys on macOS act as "global hot keys" and are not currently implemented. The Chromium source cites this blog post as the source for their implementation: https://weblog.rogueamoeba.com/2007/09/29/ Please consider this for this issue.
Comment 12•6 years ago
|
||
Maybe some mod could add this bug to the block list ;) https://bugzilla.mozilla.org/show_bug.cgi?id=448910 Once 1251795 is solved, 448910 will be solved as well. Some ideas on behavior: If you use the media keys, then you only want to play one song at a time. If the OS and the browser are playing media: ignore the media keys all along. If the OS is playing something, but the browser isn't, let the OS handle the request. If the browser is playing something but the OS isn't, then we are concerned: Play/Pause the playback of the one thing that's playing at the moment/has been played last. If the browser is already playing more than one media element currently, then ignore the media keys. next/previous probably can only be handled on a per domain/service basis afaik (because youtube and others already provide keys for that, to which these can be mapped), for all other domains those keys need to be provided by an API to the website or ignored. This behavior should work completely in the background (when the browser is minimized), because that's when you're usually using those keys ;) On OSes where it's supported: (Opt-in) show the overlay for media (like on windows 10: https://getmusicbee.com/images/forum/MediaControlOverlay.jpg ) another suggestion: offer a way to set alternative keys for Firefox itself, that work even when the OS is playing back media. Maybe even only for one domain (like youtube/soundcloud etc.) User can then again map those shortcuts to certain keys on their keyboard (example for logitech: http://www.arlt.com/out/pictures/landingpages/logitech/1230637/3.png )
Updated•6 years ago
|
Updated•6 years ago
|
Comment 13•6 years ago
|
||
(In reply to Steven Penny from comment #10) > Actually, it appears that media keys *are working*, just not globally. > Example > "manifest.json": > > { > "name": "wh", > "version": "1.0.0", > "manifest_version": 2, > "background": { > "scripts": ["xr.js"] > }, > "commands": { > "ya": { > "suggested_key": { > "default": "MediaPlayPause" > } > } > } > } > > and "xr.js": > > browser.commands.onCommand.addListener( > zu => console.log(zu) > ); > > Until global is implemented: > > http://bugzilla.mozilla.org/show_bug.cgi?id=1411795 > > the above will only work if the browser has focus. That's actually the only Media event implemented. I tested yesterday and found that all my media keys send the MediaPlayPause event. This bug is probably really easy to fix for Windows considering the current behavior; probably just some key mappings are needed.
Comment 14•6 years ago
|
||
My testing on Ubuntu 16.04, Firefox 62.0.3 with Carlin Scott's browser-media-keys extension showed that a number of extended keys all trigger the MediaPlayPause event in Firefox. In particular the following keys: XF86Tools, XF86WLAN, XF86Search, XF86LaunchA, XF86Explorer.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 15•5 years ago
|
||
Moving down in priority? This is a pretty important issue for Firefox and media playback I would think.
Comment 16•5 years ago
|
||
Comment 17•5 years ago
|
||
So, I've recently had to switch browsers due to some problems I've had with Safari, and realized that the media keys don't work. Don't worry though! I came up with a quick patch for macOS. Obviously this on its own wouldn't be enough to cover all supported platforms on this ticket, but if the firefox team is interested in letting me take this on, I'd be happy to see what I can do.
I submitted the work I've done so far on phabricator. It is nowhere close to perfect, and has a ton of problems, but hopefully it will give you a good idea of how I would handle this.
https://phabricator.services.mozilla.com/D46890
I realize I'm probably not following the proper channels on this, so thank you for your patience.
Comment 18•5 years ago
|
||
Needinfo-ing Jimm to review the patches (although he may be out of office for a while).
Updated•5 years ago
|
Comment 19•5 years ago
|
||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 20•5 years ago
|
||
We should maintain this bug as an implementation for supporting sending global media keys to web extension, and use other bugs to track the implementation for each platform.
On OSX, we have bug1591230.
On Windows, we have bug1584542.
On Linux, we have bug1584030.
Comment 21•5 years ago
|
||
Comment on attachment 9094796 [details]
Bug 1251795 On macOS use MediaPlayer library for media keys when available.
Revision D46890 was moved to bug 1591230. Setting attachment 9094796 [details] to obsolete.
Comment 22•5 years ago
|
||
An extension that would benefit the most from this is https://addons.mozilla.org/en-US/firefox/addon/media-keys/
Comment 23•4 years ago
|
||
I found a translation extension, provide Works Outside of Browser
mode, now it only works in chrome. See extension doc for detail: saladict
If FF can support global shortcuts, I can use this translation tool everywhere.
Updated•2 years ago
|
Description
•