Skip to content

Instantly share code, notes, and snippets.

@ashtonmeuser
Created January 24, 2025 22:17
Show Gist options
  • Save ashtonmeuser/6fdaaa17c701ebb01760cfa3a72b319e to your computer and use it in GitHub Desktop.
Save ashtonmeuser/6fdaaa17c701ebb01760cfa3a72b319e to your computer and use it in GitHub Desktop.
Toggle the playback speed of a video
// bookmarklet-title: Playback Speed
// bookmarklet-about: Toggle video playback speed
const video = document.querySelector('video');
if (video) {
const rates = [1.0, 1.5, 2.0];
const rate = video.playbackRate;
const index = rates.indexOf(rate);
video.playbackRate = index >= 0 ? rates[(index + 1) % rates.length] : rates[0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment