81

I have a nifty keyboard with media controls (play, stop, pause, forward and reverse). Is there any way to use them to control Youtube? That is, so that it pauses when I hit the pause key and moves back and forth between clips on the playlist with the forward and reverse keys?

Nathan Fellman
  • 9,372
  • 20
  • 62
  • 82

6 Answers6

65

This extension worked for me:

Global hotkeys for your favourite music players.

Control players inside Chrome from anywhere on your computer.

Source Streamkeys

I am using it on Last.fm

Update: Google removed it from the store.

Update: Back in the google store.

More info and how to download: github.com/berrberr/streamkeys/issues/416

Here is a link to zipped extension: https://drive.google.com/file/d/1T4VdEpbUzZO_FNe7OCOEO1Ac8SEZceBn/view?usp=sharing

You can use load unpacked extension button on chrome://extensions page in developer mode to add.

Akira Yamamoto
  • 790
  • 8
  • 13
  • Not sure if it's a solution for you, but try http://www.streamkeys.com/guide.html The chrome app also has some settings, unfortunately none for the previous track, but everything else is there. –  Oct 09 '15 at 08:46
  • I worked for me too for the multimedia keys of my Logitech. Just close and open again the youtube video. – Smeterlink Jan 22 '17 at 18:48
  • 1
    Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change. – DavidPostill Oct 07 '17 at 20:23
  • 2
    Looks like this extension was removed from the chrome extensions store. – Jon Dosmann Apr 10 '18 at 13:14
  • More info and how to download https://github.com/berrberr/streamkeys/issues/416 – Akira Yamamoto Apr 13 '18 at 00:53
  • 3
    The extension is back https://chrome.google.com/webstore/detail/streamkeys/ekpipjofdicppbepocohdlgenahaneen – Paul C Aug 21 '18 at 08:39
  • Does not work when browser is not the focused application. This only works when you are actively in the browser, and on a different tab to the one thats playing. Useless if you are playing a game and want to play/pause whilst in that game instead of having to tab out and click on Chrome to pause the video – J-Bobo Apr 06 '23 at 17:00
13

Chrome 73 does it out of box.

Some people may even want to disable it at chrome://flags/#hardware-media-key-handling (source).

Victor Sergienko
  • 728
  • 8
  • 23
7

I find BearedSpice to be the great solution. It works for Safari and Chrome (probably other web browsers) as well as media players like Spotify and iTunes.

Fish Monitor
  • 430
  • 5
  • 9
  • Hmm, seems I can't use the existing media keys on my mac with this, and it doesn't come with keybindings by default. Feeling pretty uncreative. What did you end up using for keybindings? – adamlogan Feb 23 '16 at 07:07
  • I can use the media keys, but in Youtube and Safari, the next video cannot play automatically. – Fish Monitor Feb 23 '16 at 07:21
  • 1
    I was using Firefox and testing with Focus At Will. Just tested with Chrome and it works fine. I was able to bind fn + f7 f8 f9 which are the media keys, so that's good enough for me. I tend to use chrome anyways for music as I love the [musixmatch](https://chrome.google.com/webstore/detail/lyrics-here-by-rob-w/lifkpflabnobkgbjpcmocmgcajlecbcp?hl=en-US&utm_source=chrome-ntp-launcher) and [lyrics here](https://chrome.google.com/webstore/detail/musixmatch-lyrics-for-you/gfenjblodoldnbiddmggcbkcapiolbig?hl=en-US&utm_source=chrome-ntp-launcher) addon extensions. happy camper :) – adamlogan Feb 23 '16 at 07:40
  • It looks like a very well-made app, but it's just not working for me with Safari and YouTube. No idea why. Doesn't show YouTube as an option, only iTunes. – sudo Sep 13 '17 at 00:03
5

For an answer that supports Firefox 57, since the add-on Media Keys which solves the problem in this post does not work in this version.

A full answer can be found here. I will only resume here the main points.

The problem arrives because Firefox 57 drops support for XUL add-ons, now called "Legacy", in favor of WebExtensions which are compatible with Google Chrome. This means that the vast majority of add-ons will become unusable.

The solutions I have listed in the above link are :

  • Ask the developers of the Media Keys add-on to make the effort of converting it 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.

  • Turn off updates and stay with Firefox 56 forever - not a real solution.

  • Switch to Firefox ESR which will continue in version 56 until June, 2018.

  • Switch to another fork of Firefox that keeps XUL add-ons:

  • Use Chrome extensions in Firefox 57. The Firefox add-on Chrome Store Foxified already allows this. The Chrome extension Streamkeys may fit the bill.

  • For the media keys that are not handled by the operating system, use AutoHotkey to map the media keys to Youtube key shortcuts.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • Since this is still not fixed http://bugzilla.mozilla.org/show_bug.cgi?id=1411795 I am switching to http://github.com/henrypp/chromium which works great with Streamkeys as you said. Thanks for your answer but Mozilla really failed here – Zombo Dec 09 '17 at 16:18
  • @StevenPenny: Chrom(ium) suffers from the same problems as Firefox 57+ does now : Lack of control for the extensions over the basic engine. For example, try to place the tabs below the address line, and much more. These insurmountable Chrom(ium) problems are a child's play in Waterfox. – harrymc Dec 10 '17 at 17:17
3

With a non-obvious trick, you can use keyboard keys without installing any extension or plugin. It doesn't do exactly what you asked for but works with all keyboards.

To initiate, click on the video progress bar once. Now the progress bar control has focus and following keystrokes work.

  1. Space Pause/Play
  2. Right Forward by 5 seconds*
  3. Left Rewind by 5 seconds*
  4. PgUp Forward by 1 minute*
  5. PgDn Rewind by 1 minute*
  6. Home Jump to the beginning.
  7. End Jump to the End (You see a pattern developing by now).

* (could be different based on video length; I've not tested a lot)

After initial click the focus is not obvious but as soon as you use any of the above keys then the "focus" is obvious because of change of the background color. See image here.

enter image description here There's more.. Once the focus is obvious on the progress bar Tab and Shift-Tab will move to other controls, i.e. [Play] [Jump to End] [Volume] [Volume Slider] [CC] and so on. Each control button will react to Space. [Jump to End] did not work for me. Someone at Youtube's 508 compliance missed it.

You can tab to the [Volume] button and use Up and Down keys to change the volume. While there Space will mute/un-mute.

If you Tab once more, it exposes the sometimes invisible [Volume] control. Here you can use Left and Right to change volume.

Finally, my favorite! You can jump to a percentage of the video i.e. Press

  • 1 - Jump to 10% of video.
  • 2 - Jump to 20% of video.
  • . etc.
  • . etc.
  • 9 - Jump to 90% of video.

These were most likely developed for 508-usability compliance but I find them very convenient and hope others do too.

LMSingh
  • 857
  • 6
  • 14
  • 6
    This does not work if you change tabs – Zombo Oct 09 '17 at 21:00
  • @StevenPenny that is normal behavior. Because the progress bar no longer will get the keystrokes. The keystrokes now obviously need to go to the newly focused tab. BTW, if you switch back to the tab, at least in my tests, the keystrokes continue to work the same way. Keep in mind as I mentioned at the beginning, this is not exactly what the original author asked. I'm simply providing something, others might find useful. – LMSingh Oct 10 '17 at 01:51
  • 1
    It is because of this answer, I won't be able to say that this is a *shopping recommendation* question.... Even though it does not answer the OP question directly, this hack could be used by anyone with a normal keyboard. +1 for that! – Prasanna Oct 10 '17 at 06:52
  • 1
    One more useful control : < and > move backwards and forwards in time by one frame, respectively. – OceanBagel Jul 16 '18 at 20:31
1

If you refer to Chrome as browser, there is https://chrome.google.com/webstore/detail/key-socket-media-keys/fphfgdknbpakeedbaenojjdcdoajihik which even is open source https://github.com/borismus/keysocket.

bk138
  • 139
  • 3