• Resolved romantic20

    (@romantic20)


    Hi, I’m building new website (currently locally) and it has a problem with loading videos via Ajax Load More plugin (for infinite scroll feature) – looks like shortcode processed not right and video objects are loading like this: <video-js id=”videojs60ec506638388″ class=”vjs-big-play-centered” controls=”” preload=”metadata” playsinline=”” data-setup=”{"fluid": true}”>
    <source src=”http://example.url/wp-content/uploads/2021/07/20190513_111326.mp4&#8243; type=”video/mp4″>
    </video-js> so it is like a zero size object.
    If to load videos without Ajax, normally – they loads and shows perfectly. Can it be solved somehow?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Noor Alam

    (@naa986)

    @romantic20, The plugin has no control over when or how the shortcode will be processed. This is done by WordPress.

    Thread Starter romantic20

    (@romantic20)

    Yes, I understand. But as far as I was able to find out in different sources, wordpress has problems with shortcodes in Ajax routines. So I was asking is there alternative way to show your video player, without shortcode maybe?

    Thread Starter romantic20

    (@romantic20)

    Hi again, Noor!

    Ajax Load More plugin author said that I could use player reinitalization via their special function https://connekthq.com/plugins/ajax-load-more/docs/callback-functions/almcomplete/ – just have to find out what player’s function I should run with this function. May you please help me with it?

    Thread Starter romantic20

    (@romantic20)

    With the function name I would be able to reinitialize video player and it will be working normally, like in this example for Contact Form 7:
    // Contact Form 7 (https://en-ca.wordpress.org/plugins/contact-form-7/)
    window.almComplete = function(alm){
    if(wpcf7){
    wpcf7.initForm( $(‘.wpcf7-form’));
    }
    };
    Without knowing this I will have to switch to alternative player, which would be pretty unfortunate, as I really like your player. So can you please help me with your initialization function?

    Thread Starter romantic20

    (@romantic20)

    Hi Noor, I’ve tested your plugin with other Ajax-powered themes and plugins – it doesn’t work with any of them! So when content is showing with Ajax – Videojs HTML5 Player isn’t showing at all because of incorrect initialization. So this is definitely a bug that should be addressed.

    Plugin Author Noor Alam

    (@naa986)

    @romantic20, The player is automatically being initialized by the Videojs script after the page is loaded. The plugin is not manually initializing the player.

    Thread Starter romantic20

    (@romantic20)

    Yes, but many popular themes (like Divi) and plugins like ( YITH Infinite Scrolling) using Ajax to load post contents. And plugin not working with them.

    Thread Starter romantic20

    (@romantic20)

    So the question is: in situation, when your player loaded with Ajax, it has to be re-initialized (like it was done at page loading). How could it be done? With function maybe?

    Thread Starter romantic20

    (@romantic20)

    Actually, don’t bother yourself – I have found a solution by my own. Just used Ajax load more documentation (link to which I sent to you before) and VideoJS player documentation. Function, that makes your player to work in ajax calls:

    <script>
    jQuery(document).ready(function($){
    window.almComplete = function(alm){
    var massVideo = $(‘.vjs-big-play-centered’);
    for(var i = 0; i < massVideo.length; i++){
    videojs(massVideo[i]).ready(function(){});
    }
    }
    });
    </script>

    No need to thank.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Loading via Ajax Load More isn’t working’ is closed to new replies.