Created
January 24, 2025 22:17
-
-
Save ashtonmeuser/6fdaaa17c701ebb01760cfa3a72b319e to your computer and use it in GitHub Desktop.
Toggle the playback speed of a video
This file contains 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
// 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