Small tweaks to video playback

This commit is contained in:
Mike Wickett 2018-06-25 13:41:31 -04:00 committed by Jack Pearkes
parent 0a8a542877
commit e5d7e2ec47
1 changed files with 7 additions and 4 deletions

View File

@ -27,8 +27,10 @@ function initialiateVideoChange(index) {
)
loadingBar.style.transitionDuration = '0s'
// reset the current video
$$videos[currentIndex].currentTime = 0
// reset the current video
if (!isNaN($$videos[currentIndex].duration)) {
$$videos[currentIndex].currentTime = 0
}
$$videoControls[currentIndex].classList.remove('playing')
// stop deactivation
@ -59,7 +61,8 @@ function playVideo(index, wrapper) {
$$videoControls[index].querySelector(
'.progress-bar span'
).style.transitionDuration = `${Math.ceil($$videos[index].duration / playbackRate)}s`
).style.transitionDuration =
Math.ceil($$videos[index].duration / playbackRate).toString() + 's'
// set the currentIndex to be that of the current video's index
currentIndex = index
@ -88,4 +91,4 @@ for (var i = 0; i < $$videoControls.length; i++) {
// go to first video to start this thing
if ($$videos.length > 0) {
initialiateVideoChange(0)
}
}