Skip to content

Instantly share code, notes, and snippets.

@nonoesp
Last active April 22, 2021 15:50
Show Gist options
  • Save nonoesp/ed3448e0ed223883f1c73c5ffdf02d70 to your computer and use it in GitHub Desktop.
Save nonoesp/ed3448e0ed223883f1c73c5ffdf02d70 to your computer and use it in GitHub Desktop.
Override Playback of Audio and Video HTML5 Elements
// Nono Martínez Alonso
// Nono.MA
// 2021.04.22
// MIT License
let overridePlaybackSpeed = 5;
let overridePlaybackVolume = 0;
setInterval(() => {
// Obtain all button-counter elements
let elements = document.getElementsByClassName('audio-player__audio-element');
// Convert HTMLCollection to array
let arr = Array.prototype.slice.call( elements );
// Loop through array and mount all elements
arr.forEach((el) => {
console.log(el);
el.playbackRate = overridePlaybackSpeed;
el.volume = overridePlaybackVolume;
});
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment