83

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?

Giacomo1968
  • 58,727

7 Answers7

66

Update 2024-09-16


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.

Blindspots
  • 3,472
15

Chrome 73 does it out of box.

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

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.

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
  • 498,455
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
  • 847
  • 6
  • 14
0

It might sound simple but I had lots of success in making my media keys work with youtube (and html5 video players) by using a combo of simple shortcuts made with the Shortcuts app + BetterTouchTool.

A screenshot from BetterTouchTool

My Mac Shortcuts

bteo
  • 126
  • 2
0

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
  • 147