Skip to content

Instantly share code, notes, and snippets.

@hackmods
Created April 10, 2018 00:27
Show Gist options
  • Save hackmods/a929685294fc976eef94aee1a9f5191b to your computer and use it in GitHub Desktop.
Save hackmods/a929685294fc976eef94aee1a9f5191b to your computer and use it in GitHub Desktop.
Control HTML5 Video playback speed and volume by VIDEO element
<!DOCTYPE html>
<html>
<body>
<video width="444" controls>
<source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
<source src="https://www.w3schools.com/html/mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
<script>
//Iterate through all elements to find video tags, then speed up the play rate and lower the volume.
Array.prototype.slice.call(document.all).forEach(element => element.tagName === "VIDEO" && (element.playbackRate = 2.5) && (element.volume = 0.5))
</script>
</body>
</html>
@hackmods
Copy link
Author

hackmods commented Apr 10, 2018

Inspired from here: https://www.reddit.com/r/programming/comments/8astog/berkeley_offers_its_fastestgrowing_course_data/dx2bedl/. I plan to work this into a chrome extension (on GitHub) in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment