Created
May 7, 2020 16:14
-
-
Save GabiGrin/3f071f84f57edf5988ee9a04bc4ee3b5 to your computer and use it in GitHub Desktop.
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
(() => { | |
const desiredSpeed = 1.5; | |
const timeToDesiredSpeed = 5 * 60 * 1000; // 3 minutes | |
const intervalSpeed = 5000; | |
const intervals = timeToDesiredSpeed / intervalSpeed; | |
const speedingRate = (desiredSpeed - 1) / intervals; | |
const start = new Date(); | |
setInterval(() => { | |
const vid = document.querySelector('video'); | |
const curr = vid.playbackRate; | |
const newSpeed = Math.min(desiredSpeed, curr + speedingRate); | |
console.info(`Speeding ${curr} -> ${newSpeed}`); | |
vid.playbackRate = newSpeed; | |
}, intervalSpeed); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment