Skip to content

Instantly share code, notes, and snippets.

@DarrenRainey
Created February 20, 2024 14:07
Show Gist options
  • Save DarrenRainey/47eaa7af17f3bdef5d94ba72dbe0ce93 to your computer and use it in GitHub Desktop.
Save DarrenRainey/47eaa7af17f3bdef5d94ba72dbe0ce93 to your computer and use it in GitHub Desktop.
Pause YouTube video after x seconds
// Darren Rainey 2024 - github.com/Darren
//
// A Simple javascript snippet to pause a youtube video after x seconds
// Simply copy and paste in Chrome devtools / console and run
// pause(60) to pause the current video after 60 seconds.
function pause(timeInSeconds){
seconds = timeInSeconds * 1000
setTimeout(() => {
document.getElementsByClassName("ytp-play-button ytp-button")[0].click()
}, seconds)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment