Skip to content

Instantly share code, notes, and snippets.

Last active October 25, 2020 15:27
What would you like to do?
Control YouTube playback rate
* In order to have this function always at hand and use it in
* any website, just add the code below to a bookmark in your favorite browser.
* Every time you click it, the browser will prompt you for a new playback
* rate for first video in the page.
javascript:(function() {
const rate = prompt('Set the new playback rate', 2.5);
if (rate != null) {
const video = document.getElementsByTagName('video')[0];
video.playbackRate = parseFloat(rate);
* YouTube videos (along with all modern video implementations on the web)
* uses the HTML5 video element (
* This new media tag implements the HTMLMediaElement API (,
* which gives a plenty of media-related methods common to audio and video.
* The standard YouTube player just allow us to increase video speed up to 2x, but, if
* you want to increase it even more? Well, there's a solution for that: just set the
* playback rate to whatever number you want!
* The function below receives one argument with the playback rate, selects the first
* <video> element in the page and applies the new playback rate.
function setVideoPlaybackRate(rate = 1) {
document.getElementsByTagName('video')[0].playbackRate = rate;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment