Last active
July 31, 2025 23:11
-
-
Save veilm/451ce045a34a5657c871494251db295b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name YouTube Unpause | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Disable the programmatic pausing of YouTube videos in response to detecting adblock | |
| // @author Michael | |
| // @match https://www.youtube.com/watch?v=* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com | |
| // @grant none | |
| // ==/UserScript== | |
| const inputDelay = 250 | |
| let userPaused = false | |
| let video | |
| const userInput = () => { | |
| userPaused = true | |
| setTimeout(() => { | |
| if (video && !video.paused) | |
| userPaused = false | |
| }, inputDelay) | |
| } | |
| document.addEventListener("click", userInput) | |
| document.addEventListener("keydown", userInput) | |
| const setVideo = setInterval(() => { | |
| video = document.getElementsByTagName("video")[0] | |
| if (video) { | |
| clearInterval(setVideo) | |
| video.addEventListener("pause", () => { | |
| if (!userPaused && video.currentTime < video.duration) | |
| video.play() | |
| }) | |
| } | |
| }, 10) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
YouTube Unpause
Everyone knows you can hide YouTube's adblock popup using uBlock Origin, but that still requires you to often unpause the video after the hidden popup shows up. This userscript hopefully fixes that, by automatically unpausing the video whenever it gets paused more than
inputDelayms after keyboard input or a mouse click. Occasionally there is some lag when pausing a video, which is whyinputDelayisn't something particularly low like 15 ms.