Use Media Keys for Soundcloud, YouTube, etc.. in Firefox?
The Media Keys add-on does not work in Firefox version 57, because the developers have decided to remake Firefox into a Chrome clone. For November 2017, they have announced their intention to drop in Firefox 57 their current add-on format, now called "Legacy", in favor of WebExtensions, which in plain English are very similar to Google Chrome extensions.
This will in theory open most of the Chrome Store to Firefox users, but will invalidate all, and I do mean all, current add-ons whose developers will not convert in time to WebExtensions.
One can already see the problem in Firefox 56 by opening the Add-ons tool. The add-ons that will not work in version 57 are marked by a yellow LEGACY notice :
I have 46 add-ons in Firefox with which I have created the environment that is just right for me. All of them, except only one, are marked as legacy. The problem is much more general and extensive than you think.
Some possible solutions are listed below :
Ask the developers of your add-ons to make the effort of converting to WebExtensions.
Firefox 57 will include a "find similar extension" tool which might help to find replacement add-ons.
Abandon Firefox in favor of Chrome (I'm sure that a large percentage of Firefox users will follow this route).
Turn off updates and stay with Firefox 56 forever - not a real solution. One can also use here Firefox Portable.
Switch to Firefox ESR which will continue in version 56 until June 26, 2018, in the hope that someone will come up until then with a solution for running legacy add-ons in Firefox 57. This is not really much different from the above solution, except that critical updates will not be blocked.
Switch to Pale Moon, or Waterfox, both forked from Firefox, although not all add-ons are compatible.
None of these solutions is perfect, but I don't know of a better one at the moment. I think that the Firefox developers made a very stupid decision which will cost them a hefty chunk of their already eroding market share, but they are not asking for anybody's advice.
Another solution would be to use Chrome extensions in Firefox 57. The add-on Chrome Store Foxified already allows this.
From the article How many Chrome extensions will run in Firefox :
Mozilla's Andy McKay decided to find out in November 2016. He parsed the Chrome store sitemap and got 100,000 extensions, apps and themes out of it which he analyzed to find out how many of them will run in Firefox.
According to his findings, about 76% of Chrome extensions of the sample size will run in Firefox. The remaining extensions either miss one or more APIs, one or more permissions, or one or more manifest.
I have found the Chrome extension Streamkeys which according to its author does everything you asked for. However, not having Firefox 57, I don't know if it will work in it.
References :
- How many Chrome extensions will run in Firefox?
- How many Chrome Extensions run in Firefox?
- How to Install Chrome Extensions in Firefox
A very light-weight solution for all browsers and versions, makes use of the following observations:
- Some media keys are handled by the operating system, especially the volume keys
- Most media players have hotkeys with the same functionality as the keyboard Media keys
Specifically for youtube, a list of the hotkeys can be found in the article 30+ YouTube Keyboard Shortcuts You Need to Know. Some of the ones corresponding to the keyboard media keys are:
Spacebar - Pause/Play video (player focus required)
K key - Pause/Play video (doesn’t require focus)
↑ (Arrow key up) - Turn up volume 5%
↓ (Arrow key down) - Turn down volume 5%
Ctrl+→ - Move to next video (only in playlist)
Ctrl+← - Move to previous video (only in playlist)
These keyboard's media keys can be mapped to these keys using AutoHotkey. A list of AutoHotkey key-names is found in the article List of Keys, Mouse Buttons, and Joystick Controls.
An example of a AutoHotkey script for Youtube is:
SetTitleMatchMode, 2 ; match anywhere in window's title
#ifWinActive YouTube ; only if window title contains YouTube
Media_Next:: Send ^{Right} ; Next Track - ctrl+right-arrow
Media_Prev:: Send ^{Left} ; Previous Track - ctrl+left-arrow
Media_Play_Pause:: ; Stop/Start - Spacebar
Media_Stop:: Send {Space}
The above script is completely untested, as my keyboard does not have these keys.
Media Keys
Yes it is possible! For this download Media Keys from addons.mozilla.org. This tool adds a media key event listener to Firefox and makes it possible to use:
- Play/Pause
- Next
- Previous
- Stop
on every supported music/video site.
Issue
For some reason the media keys are only working if Firefox is the active window (occured on Windows 10). Also add-on currently does not work with Firefox 57+.