Javascript Image Slider / Posts /

Force video slider to automatically play the video only for the first time

63
Is there anyway in having a video within a slideshow, that automatically plays, then continues playing the slideshow, but the next time the video comes it doesn’t play automatically.
 
For example. I now have autoplayvideo=true, and then the slide continues after the video has finishes, but then the video plays again. I want it not play the next time.
Greg  4 years ago   viewed: 12856    

2 Answers

0
Thank you very much for this solution! Much Appreciated.
Greg   4 years ago
-1
[admin] Since version v2013.8.27, just add attribute data-autovideo="1" to the video and the slider will only auto play for the first time. Please visit Video Slider for details.

The post below is the solution for previous versions of the slider.

Take the downloaded demo 6 as an example. The fifth slide automatically plays. By adding the following script to the page, you can get what you expected: the video auto plays only for the first time, but will not auto-play afterwards.
<script type="text/javascript"> function getVideoLink(slideImage) { var link = null; if (slideImage.parentNode.nodeName == "A") link = slideImage.parentNode; return link; } function afterSlideChange(args) { //args[0]-currentSlide index, args[1]-currentImage if (args[0] == 4) { var videoLink = getVideoLink(args[1]); if (videoLink != null && videoLink.getAttribute("autoPlayVideo")=="true") { videoLink.setAttribute("autoPlayVideo", "false"); } } } </script>
milo
  4 years ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: