Skip to content

Instantly share code, notes, and snippets.

@lupomontero
Created April 18, 2019 21:05
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save lupomontero/d743e4f6e2566b9fcfae907310b2dac5 to your computer and use it in GitHub Desktop.
Save lupomontero/d743e4f6e2566b9fcfae907310b2dac5 to your computer and use it in GitHub Desktop.
const video = document.getElementsByTagName('video')[0];
const slider = document.createElement('input');
slider.type = 'range';
slider.min = 0.5;
slider.max = 3;
slider.step = 0.25;
slider.value = 1;
document.body.appendChild(slider);
slider.style.position = 'absolute';
slider.style.zIndex = 9999;
const indicator = document.createElement('div');
indicator.textContent = '1x';
document.body.appendChild(indicator);
indicator.style.position = 'absolute';
indicator.style.zIndex = 9999;
indicator.style.right = 0;
indicator.style.fontSize = '30px';
slider.addEventListener('change', (e) => {
video.playbackRate = e.target.value;
indicator.textContent = `${e.target.value}x`;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment