Section background video - kary4/divituts GitHub Wiki
How to enable video background on small screens: https://www.elegantthemes.com/forum/viewtopic.php?f=187&t=896962&p=4890052#p4890052
stop the looping at the end on the last frame
<script>
jQuery( document ).ready(function() {
jQuery('.et_pb_section_video_bg video').prop('loop', false);
jQuery('.et_pb_section_video_bg video').get(0).addEventListener('ended', function() {
this.currentTime = 100;
}, false);
});
</script>
Replace 100 with the end time of your video.
Stop at a certain time:
<script>
jQuery( document ).ready(function() {
jQuery('.et_pb_section_video_bg video').get(0).addEventListener("timeupdate", function(){
if(this.currentTime >= 26) {
this.pause();
}
});
});
</script>
To enable autoplay in the chrome browser, you need to mute the video. Please add the following code to Dashboard > Divi > Theme options> Integration > Add code to the < head > of your blog option:
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(".et_pb_section_video_bg video").prop('muted', true);
});
</script>
Stop any videos (iframe or video):
<script>
jQuery( document ).ready(function() {
/**
* Stop an iframe or HTML5 <video> from playing
* @param {Element} element The element that contains the video
*/
var stopVideo = function ( element ) {
var iframe = element.querySelector( 'iframe');
var video = element.querySelector( 'video' );
if ( iframe ) {
var iframeSrc = iframe.src;
iframe.src = iframeSrc;
}
if ( video ) {
video.pause();
}
};
jQuery('.et_bloom_close_button').click(function(){
stopVideo(document);
});
});
</script>