Menu

introurl problem

Help
Albert
2012-05-19
2013-04-06
  • Albert

    Albert - 2012-05-19

    Hey Federico, it's me again to bother you once again D:

    This player gets better with every version, its a very promising project, congratulations on your work.

    Well we're updating our website and we decided to use the last version of ffmp3, we installed it and works fine except for one little annoying thing, when we open the website we get the "FFMP3: intro -" and the url of the file, and next we get "FFMP3: intro - 0" and sometimes we get the first one again.

    We are using a mp3 stream, fallback and introurl, js enabled and tracking too. And when we don't use introurl we still get the second message.

    As you can see this might be a problem for the users of our site, so we'd really appreciate any help you could give us.

    You can check our problem here http://radio3hp.com/new

    Regards
    Albert

     
  • Ezequiel Geringer

    Hi Albert,
    the problem is that you're using an example ffmp3Callback function, that calls alert on some js events.

    The function in your HTML is:

    <script type="text/javascript">
           function ffmp3Callback(event,param){
                   switch(event){
                           case "volume":
                                   document.getElementById('ffmp3volume').innerHTML=param;
                                   break;
                           case "buffering":
                                   document.getElementById('buffering').style.display="block";
                                   break;
                           case "play":
                           case "stop":
                           case "ioError":
                                   document.getElementById('ffmp3status').innerHTML=event;
                                   document.getElementById('buffering').style.display="none";
                                   break;
                           case "metadata-json":
                                   document.getElementById('ffmp3metadatajson').innerHTML=param;
                                   eval("var metadata="+param+";");
                                   // here you have the metadata object to play with.
                                   break;
                           case "metadata":
                                   document.getElementById('ffmp3parsedmetadata').innerHTML=param;
                                   break;
                           case "source":
                                   document.getElementById('ffmp3source').innerHTML=param;
                                   break;
                           case "fallback":
                                   document.getElementById('ffmp3fallback').innerHTML=param;
                                   break;
                           default:
                                   alert("FFMP3: "+event+" - "+param);
                                   break;
                       }
              }
        </script>
    

    First, you need to delete the alert call:

    <script type="text/javascript">
           function ffmp3Callback(event,param){
                   switch(event){
                           ...
                           ...
                           default:
                                   // alert("FFMP3: "+event+" - "+param); <-- Comment or remove this line
                                   break;
                       }
              }
        </script>
    

    You can also remove the cases you're not using (as volume, source, fallback, play, stop, ioerror, buffering, etc) and leave your function like this:

    <script type="text/javascript">
           function ffmp3Callback(event,param){
                   switch(event){
                           case "metadata-json":
                                   document.getElementById('ffmp3metadatajson').innerHTML=param;
                                   eval("var metadata="+param+";");
                                   // here you have the metadata object to play with.
                                   break;
                           case "metadata":
                                   document.getElementById('ffmp3parsedmetadata').innerHTML=param;
                                   break;
                           default:
                                   break;
                       }
              }
        </script>
    

    Best regards,
    Ezequiel

     
  • Albert

    Albert - 2012-05-23

    Thanks Ezequiel

    I'll Try and let you know what happens.

    Regards
    Albert

     
  • Albert

    Albert - 2012-05-23

    Thanks Ezequiel, the solution you provided it's great. Works just fine.

    You guys should start a wiki page with how to's and useful info like this for the newbies like us.

    Regards

     
  • Ezequiel Geringer

    Yes, we're planning to have a Wiki soon. It'll be great for beginners to find useful information.

    See you soon, Albert!

    Greetings.

     

Log in to post a comment.