Youtube Spacebar Pause/Play Fix

A Youtube bug disables the space key shortcut, which often happens when you change windows and return to Youtube, often with the ALT + TAB shortcut. This script ensures that the spacebar PAUSE / PLAY shortcut works correctly.

< Feedback on Youtube Spacebar Pause/Play Fix

Review: OK - script works, but has bugs

§
Posted: 08-11-2023
Edited: 08-11-2023

It won't work until you go to url http://youtube.com/watch... directly, not from https://youtube.com. It's because youtube has it's own refresh system, so tampermonkey can't take that you're opened a video. Simple fix: just replace

// @match https://www.youtube.com/watch*
// @match http://www.youtube.com/watch*
// @match https://youtube.com/watch*
// @match http://youtube.com/watch*

with

// @include https://www.youtube.com*
// @include http://www.youtube.com*
// @include https://youtube.com*
// @include http://youtube.com*

§
Posted: 10-11-2023

It won't work until you go to url http://youtube.com/watch... directly, not from https://youtube.com. It's because youtube has it's own refresh system, so tampermonkey can't take that you're opened a video. Simple fix: just replace

// @match https://www.youtube.com/watch*
// @match http://www.youtube.com/watch*
// @match https://youtube.com/watch*
// @match http://youtube.com/watch*

with

// @include https://www.youtube.com*
// @include http://www.youtube.com*
// @include https://youtube.com*
// @include http://youtube.com*

Thank you for your very constructive comment ! It's true I hadn't taken into account the fact that youtube uses this single page system.

I fixed that in my last update and normally it should work just fine event we go from https://youtube.com or any other youtube page, I invite you to download the last version since I also had to change a few things (like updating the listeners on the video each time you open a new video page etc...).

Post reply

Sign in to post a reply.