Tagged: easy slider, video
-
AuthorPosts
-
May 6, 2015 at 11:43 pm #440694
Hi,
I have a video on my home page (www.smarthalo.bike) that I want to play only once (it’s the intro video at the top my home page). Since there is no option to stop the looping by default on Enfold (correct me if I’m wrong!), I have tried these options:
1. I have tried setting ‘video_loop’ => false in section.php to make the looping stop on a background video, but in chrome (mac), when the video ends, it reverts back to the first frame when it stops which is no good for my needs.
2. This is what’s currently in place: I have created an Easy Slider: on the first slide, I have my video, and then, on the second, a static image of my video’s final frame. So, when the video finishes, it goes to the second frame and stays there, since I checked the box “disable autorotation when this last slide is displayed”. It works partially and is not ideal… In chrome (mac), between the two slides, there is a slight glitch where the video reverts back to the first frame before going to the second slide, which kinda ruins the smooth transition.
Any suggestions on what is the best way to achieve the effect I’m looking for?
Also, the video doesn’t seem to be loading on Firefox (mac, version 32.0.3). Any ideas?
Thanks in advance!
May 9, 2015 at 8:24 am #441912Hey GabrielAlberola!
Thank you for using Enfold.
Use the Color Section element then set the video_loop in section.php to false. Add this in the functions.php file:
add_action('wp_footer', 'ava_custom_script', 10); function ava_custom_script(){ ?> <script> (function($){ var video = document.getElementsByTagName('video')[0]; video.addEventListener("timeupdate", function() { if (video.currentTime >= 8) { video.pause(); console.log('paused'); }}, false); }(jQuery)); </script> <?php }
Add conditional functions if you only want to affect the video on that particular page.
Cheers!
IsmaelMay 9, 2015 at 10:20 pm #442008Awesome, it works! Thanks a lot!
May 10, 2015 at 4:00 am #442028 -
AuthorPosts
- The topic ‘Problem with looping video’ is closed to new replies.