-
AuthorPosts
-
January 5, 2021 at 2:00 am #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.
January 6, 2021 at 1:41 pm #1270605Hey 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,
IsmaelJanuary 6, 2021 at 6:35 pm #1270685I 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
}January 7, 2021 at 6:48 am #1270782Hi,
Did you need additional help with this topic or shall we close?
Best regards,
Jordan ShannonJanuary 7, 2021 at 5:53 pm #1270924Topic may be closed. Thanks!
January 9, 2021 at 4:12 am #1271180 -
AuthorPosts
- The topic ‘MP4 Video Loop Stopping at First Frame instead of Last Frame’ is closed to new replies.
