DEV Community

Cover image for YouTube speed control with JavaScript
Walter Nascimento
Walter Nascimento

Posted on

YouTube speed control with JavaScript

[Clique aqui para ler em português]

On YouTube the biggest speed of the player is only 2x, but sometimes we fall into a video that even when you put it in 2x it still seems like the person is talking very slowly, and for these cases the ideal would be to increase the speed even more, so let’s create a script that solves this with JavaScript.

Step by step

  1. First access any YouTube video, Ex .:(https://www.youtube.com/watch?v=RC6qFlXxsio)
  2. Then open your browser console (F12)
  3. Go to the console tab and type:
document.getElementsByClassName("video-stream html5-main-video")[0].playbackRate = 2.5;
Enter fullscreen mode Exit fullscreen mode

After typing and enter your video will play 2.5x faster if you want even faster just change the 2.5 for the number you want and if you want to slow down just put a smaller number, example (0.5).

In the script I also added for vimeo, you have to follow the same step by step and at the end execute the script:

document.querySelector('video').playbackRate = 2.5;
Enter fullscreen mode Exit fullscreen mode

Follow the script on gist


Thanks for reading!

If you have any questions, complaints or tips, you can leave them here in the comments. I will be happy to answer!

😊😊 See you! 😊😊

Top comments (1)

Collapse
 
circuit10 profile image
circuit10

Doing it this way causes the subtitles to desync