• Resolved sgreve

    (@sgreve)


    Just installed & set up ALM and I’m having an issue:

    My posts include an audio player (the WP core version of mediaelement.js). This displays fine on the initial posts, but when I scroll down to the ALM-loaded posts the display becomes the browser’s native <audio> player.

    (Display issues start on episode 9. Everything above that is working properly. It can be tough to see the issue on certain browsers, since the native audio player can look very similar to WP’s version of mediaelements.js.)

    Anybody know why this is happening?

    Other info that may be related:

    I’m displaying the player via Blubrry’s Powerpress plugin, with mediaelement.js selected as the audio player. However, I had this same issue when I tried to use a simple shortcode in my post body instead.

    • This topic was modified 6 years, 10 months ago by sgreve.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @sgreve,
    I’m not 100% sure but I think you’ll need to call the mediaelementplayer() function to initiate the player for every Ajax load.
    https://github.com/mediaelement/mediaelement/blob/master/docs/usage.md#initialize

    You could call this function using the almComplete callback function.
    https://connekthq.com/plugins/ajax-load-more/docs/callback-functions/almcomplete/

    Does that make sense?

    Thread Starter sgreve

    (@sgreve)

    Aah, thank you! Unfortunately I’m kind of a JS beginner can’t quite track how to do this.

    As far as I can tell I need a snippet like this:

    $(function() {
      $.fn.almComplete = function(alm){
        var base_url = 'https://myurl.com';
        $.getScript( base_url + "/wp-includes/js/media-audiovideo.min.js" );
      });
    })(jQuery);

    But the above doesn’t work. I’ve been trying to find a solution myself, but posts about this always assume a level of familiarity with the code that I just don’t have, so I’d really appreciate any pointers you can give!

    Again, thank you!

    Thread Starter sgreve

    (@sgreve)

    Aah, I’m dumb, I’m using mediaelement.js in a super-simple way, so it was incredibly basic. Here’s my snippet, in case anybody has a similar problem (stash this at the bottom of your page, just before the </body> tag):

    <script>
    	$(function() {
       $.fn.almComplete = function(alm){
          $('audio').mediaelementplayer();
       };
    })(jQuery);
    </script>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘ALM-Loaded posts ignore WP’s mediaelement.js skin?’ is closed to new replies.