codepo8 / slide-show

A full screen slide show for images and videos
https://codepo8.github.io/slide-show/slideshow.html
31 stars 15 forks source link

Video play duration #6

Open zimmerlis opened 2 years ago

zimmerlis commented 2 years ago

Video slideshow with several mp4 videos change exactly after 3000 ms to the next video. For me it would make more sense to skip the slideshow.speed on videos and use the video duration instead.

teachers-uk-net commented 2 years ago

Hi

Yes, just for anyone els ewho comes across this and wants a solution, I added an attribute to the video element vid.setAttribute('id', slideshow.media[counter]); and then in function loaded():

wrapper.dataset.loaded = 'true';
let curr = document.getElementById(slideshow.media[counter]);
  if (curr != null) {
    speed = curr.duration*1000
  } else {
    speed = 3000
  }

Might be an even better way to do it but also think this would address #2 as well.

Kind regards

Stuart