Avatar of Melody Scott
Melody Scott
Flag for United States of America

asked on 

Need help with Video in Slide Show.


user name: expertexchange
password:  BobTheBuilder45!!

The video in the first slide is almost working, thanks to an expert on here.  The last slide does transition, to the video, and then on through the slides. On initial page load, the video plays to the end, then stops, and if I hit the data-slide, it goes through the rest of the slides. But we want 1. The video plays to the end unless someone advances to next slide, then it stops. 2. The slide show should transition through, then skip the video after the video has played.

The expert says: The problem is that the slide transition event fires even when the carousel is paused.

What needs to happen is that you need to maintain a state variable that determines whether or not you have paused.

When the event fires you check this - if it is set then you e.preventDefault() the event - otherwise you let it through.

You then have to listen for the stop event on the video so you can set that state variable to false - otherwise the transition will not continue.

There is another caveat to this - if the user clicks to the next slide - then we need to cater for that - in other words stop the video and allow the transition.

Anyone care to have a go at this? I am in way over my head. Thanks!
Web DevelopmentHTMLJavaScriptjQuery

Avatar of undefined
Last Comment
Melody Scott

8/22/2022 - Mon