Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1270278

    I would like my MP4 video on the homepage to end and stop on the last frame, but right now it jumps back to the beginning and stops on the first frame. Single play, no repeat. I’m using a mac, tested on Safari, Firefox and Chrome – it appears on all of them. I was asked if I removed the Pause snippet, and I did not remove any snippets.

    #1270605

    Hey ellephillips,

    Thank you for the inquiry.

    We cannot find the pause snippet or script in the document. Did you add this snippet 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
    }
    

    This should pause the video exactly after 8 seconds.

    Related thread: https://kriesi.at/support/topic/problem-with-looping-video/#post-441912

    Best regards,
    Ismael

    #1270685

    I tried adding your code above but it brought back errors in my functions.php file. So I went to the related thread and tried that code (changing it from 8 seconds to 20 seconds), and it worked perfectly. Thank you for getting back to me with this resolution.

    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 >= 20) {
    video.pause();
    console.log(‘paused’);
    }}, false);

    }(jQuery));
    </script>
    <?php
    }

    #1270782

    Hi,

    Did you need additional help with this topic or shall we close?

    Best regards,
    Jordan Shannon

    #1270924

    Topic may be closed. Thanks!

    #1271180

    Hi,

    Thanks for the update, I’ll go ahead and close this thread for now then. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘MP4 Video Loop Stopping at First Frame instead of Last Frame’ is closed to new replies.