Play video again after carousel bootstrap starts again

I have a boot carousel, the first carousel item is a video and the others are images. When the carousel starts, the video plays automatically, and when the video ends, the carousel continues and the images are displayed. I want once the Carousel loop returns to the video again, the video plays again with auto play like the first time.

$("#homeCarousel").carousel('pause'); // this prevents the auto-loop  function homeCarouselVideo() {     $(".carousel-item").each(function(){         if($(this).hasClass('active')) {             var video = $(this).find('.d-block');             video.get(0).play();                                         }     }); } homeCarouselVideo();     $('video').on('ended', function (e) {     $("#homeCarousel").carousel('cycle') }); 

Thanks in advance for your help.

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.