Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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!

    #441912

    Hey 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!
    Ismael

    #442008

    Awesome, it works! Thanks a lot!

    #442028

    Hey!

    Glad it worked. :)

    Regards,
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Problem with looping video’ is closed to new replies.