Tuesday, January 9, 2018

Lab 24 Refection

In this lab i have to use the video player and code it so it has volume and speed up and slow down and i thought this was going to be hard but the javascript  for the this was pretty easy as soon as you watch the video and the code i use where
function togglePlay() {
  const method = video.paused ? 'play' : 'pause';
  video[method]();
}

function updateButton() {
  const icon = this.paused ? '►' : '❚ ❚';
  console.log(icon);
  toggle.textContent = icon;
}

function skip() {
 video.currentTime += parseFloat(this.dataset.skip);
}

function handleRangeUpdate() {
  video[this.name] = this.value;
}

function handleProgress() {
  const percent = (video.currentTime / video.duration) * 100;
  progressBar.style.flexBasis = `${percent}%`;
}

function scrub(e) {
  const scrubTime = (e.offsetX / progress.offsetWidth) * video.duration;
  video.currentTime = scrubTime;
}
this made code keep in track of the video and it speed and it make sure it work.

No comments:

Post a Comment