My script does not detect the redirection URL

this is the case : Needed a responsive html5 audio player and the best I found was one made by a person called Osvalds .

The first problem I found was that the " autoplay " attribute reproduced the same song twice in Firefox. I could fix this by adding a few lines of javascript (though the play button does not change the song to be played ) .

The second problem (and this is where I need help) is that the javascript does not detect or failure with URL redirect but it does work with the final URL.

I mean, my php variable to return a URL like:

" "

But this in turn redirects me to a final URL:


Ok , when I used a flash-based player , there was no problem . And when I use the "audio" tag without the script there is no problem .

I tried to fix this by passing php variable to " CURL " and it worked! But it turned out that my host does not support the " CURLOPT_FOLLOWLOCATION " .

That was another option to look at the javascript source code audio player .

This is my html:

          <audio  id="audiobox" preload="auto" controls loop>
            <source src="">

            <script type="text/javascript">
              function play() {


        <script src="jquery-1.11.0.min.js"></script>
        <script src="audioplayer.js"></script>

In this direction is the code javascript audio player: I'm no expert in javascript but I think the problem must be in line 56: "this.attr AudioFile = $ ('src')." I think if I could define the php variable directly in the script it could run. But do not know if there's another way:

This left a jsFiddle example, in this case the "src" attribute is calling the final URL that ends in MP3 and as you can see, the music plays and the player works.:

And here is the example with the problem, the same code just labeled "source" points to the URL that returns me the variable (remember that this only fails using this script):

It appears only one button (it means the player is failing).

Hope you can help me. Thanks in advance.

Edit: Here is the link to the script author:


Use this code

<script type="text/javascript">
var song=new Audio('');;

but your link not contain any MP3 i think now

Need Your Help

Android same layout different data

android eclipse string layout

I'm creating a local android application and am trying the following:

Quick blox android SDk

android push-notification quickblox

I am facing a problem in quickblox android sdk