Using Divi Theme - How to Disable video player preloading

I'm using Divi and I'm self hosting my videos. They are all small (under 5 MB) videos and about 10-30 seconds in length.

I want to create a page with a bunch of videos
http://birthdaypartymn.com/reviews-2/

But I want to stop the videos from preloading and only load when someone clicks play. This is the code I was giving and told to put in the theme options - integration - head

<script>
(function($) {
$(document).ready(function() {
$('video').attr('preload','none');
});
})(jQuery)
</script>

But this does not solve my problem. I did look at the source code and the code it loading properly on the page, but it's not stopping the preloading.

  • Adam Czajczyk

    Hello Justin Alan,

    I hope you're well today and thank you for your question!

    I have visited your site but there's no content on /reviewes-2 page. I then checked the /reviewes page and I can see four videos there but a look at the browser console and the sources loaded suggests that they are not pre-loaded. The player is loaded and then "tweaked" (most likely by some JS code) to show only video thumbnail with a "play" button overlay but the video content is not upon page load. It seems like the video file content is fetched only after the "play" button is pushed so that would confirm that there's no pre-loading.

    Is this what you wished to achieve or am I missing the point? If I misunderstood you, correct me please and I'll be happy to assist you.

    Best regards,
    Adam

  • Dimitris

    Hey there Justin Alan,

    hope you're doing good and don't mind chiming in here!

    I'm glad you've been able to sort that out. Inspecting this page the only I can spot is only this "preload" attribute so a script like the one you've mentioned should do the trick. If not, you can try to use a little timeout, like

    <script>
    (function($) {
      setTimeout(function(){
      $('video').attr('preload','none');
    }, 50);
    })( jQuery );
    </script>

    If that doesn't make the trick, then this script should be binded to the video object creation, so it may be better to advise Divi devs about it.

    Hope that was some help, let us know if further assistance is required here!
    Take care,
    Dimitris