Support » Plugin: Audio Player » Fixed my Buffering… issue; Might help someone

  • Until now I’ve been using this plugin and inserting the audio shortcode by hand as:


    I also was setting a default folder of “/mp3” in my web space. This has been working fine for years. I just recently decided I wanted to store my MP3 files in my media library. I uploaded an MP3 and inserted it into a post. In the editor window I could see the default WP HTML5 audio player. When I published the post I saw this plugin’s player. Success, I thought.

    Then I tried to play that clip and it showed Buffering… in the player that didn’t go anywhere. Looking at the source for the page I could see it wasn’t getting the absolute URL properly from the inserted shortcode which WordPress did as:

    [audio mp3=""][/audio]

    I loaded up the wp-content/plugins/audio-player.php file and on line 397 which looked like:

    $pattern = “/(<p>)?\[audio:(([^]]+))\](<\/p>)?/i”;

    I changed to:

    $pattern = “/(<p>)?\[audio mp3=\”(([^]]+))\”\]\[\/audio](<\/p>)?/i”;

    This allowed it to get the URL properly and the files now play fine. I’d prefer to not have to edit the plugin PHP directly, but it works and I’m no scientist, so I’ll stick with it. If the default HTML5 player showed ID3 tags properly then I could ditch this plugin altogether.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Dave,
    Could you post what your final code is in its entirety?

    It’s not clear exactly where you put this new information and I’m not getting any variation to work, so if I could see your final version that might help me compare with your original (which looks like mine).

    Here is what the entire section looks like with my updated pattern. I’ve updated it again since my last post.

    // Replace [audio syntax]
    if( in_array( "default", $this->options["behaviour"] ) ) {
    $pattern = "/(<p>)?\[audio(?:\:)?(?: mp3=\")?(([^]\"]+))(?:\"\]\[\/audio)?\](<\/p>)?/i";
    $content = preg_replace_callback( $pattern, array(&$this, "parseCallback"), $content );

    Okay.. so THIS:


    became THIS:

    // Replace [audio syntax]
    if( in_array( “default”, $this->options[“behaviour”] ) ) {
    $pattern = “/(<p>)?\[audio(?:\:)?(?: mp3=\”)?(([^]\”]+))(?:\”\]\[\/audio)?\](<\/p>)?/i”;
    $content = preg_replace_callback( $pattern, array(&$this, “parseCallback”), $content );

    However, when I paste your code in a player comes up, but file not found — so not sure where I need to insert the audio file. Can you guide me?

    I’m not an expert there’s obviously something I’m missing!

    What’s really weird is that the player works on the back end. I can play it just fine on the editing side — but on the public side of the site, no sound, just buffering that goes no where.

    That code I posted is what I put into one of the back end plugin PHP files, not into the WordPress post itself. You should continue to put [audio:NAMEOFFILE.mp3] in the post.

    It’s weird that you say it works in the editing side because if I put [audio:NAMEOFFILE.mp3] into the editor I don’t see the player.

    Do you have a page with a clip on that is doing the buffering that I could look at to try to help more?

    Hi Dave, no wonder what I did wasn’t working… putting code into a “back end plugin PHP file” is a bit over my pay grade.

    My test page is here and I wrote in the steps I followed

    I found two solutions that allow the player to play, but don’t include the time length of the recording. I can live with one of those for now, but sure would like to see if I can make your solution work.

    BTW, for anyone else who wants to know, the alternative solutions I found are here:

    Can you disable the “Encode mp3 URLs” option in the advanced settings for the audio player plugin? I suspect the player is looking at a bad URL, but there’s no way to see that unless you disable the encoding.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Fixed my Buffering… issue; Might help someone’ is closed to new replies.