facebook

use a dynamic URL for mobione Audio Player?

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #336915 Reply

    pbixdesign
    Member

    Hi !! You can use a dynamic URL for mobione Audio Player?
    What I want is to connect the audio player to pick up a php dynamic url.

    Thanck you !!

    #336931

    Brandon
    Member

    Here is the code to assign a url to the audio widget

    $("#m1-audio_player-audio3-player").jPlayer("setMedia", { mp3: "http://205.188.215.229:8010/" });
    $("#m1-audio_player-audio3-player").jPlayer("play");
    

    For the dynamic part you would just have to change the url to the returned url you want to use.

    #336946

    pbixdesign
    Member

    Thanks, but so far fails to operate, with this example I have the mp3 file name of an XML file, as I can use the variable? This example would be correct?

    <script>
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      var direct ="http://www.127.0.0.1/my_xml.xml"
    xmlhttp.open("GET",direct,false);
    xmlhttp.send();
    xmlDoc=xmlhttp.responseXML; 
    
    var x=xmlDoc.getElementsByTagName("CD");
    for (i=0;i<x.length;i++)
      { 
       var NEWURL=x[i].getElementsByTagName("NAME_MP3")[0].childNodes[0].nodeValue;
        document.write(NEWURL);  // list URL MP3 [b][/b]
    
    /* not correct. ?*/
    $("#m1-audio_player-audio3-player").jPlayer("setMedia", { mp3: NEWURL });
    $("#m1-audio_player-audio3-player").jPlayer("play");
      }
     </script>

    Thanck

    #336959

    pbixdesign
    Member

    would be possible to have an example?
    Thanck

    #337025

    @pbix,

    Can you try the next thing:

    Check in javascript console if there is a syntax error, that could be the reason that your NEWURL var doesn’t get the correct url.

    Also, did you rename your screen to: audio_player if no, you should change the code:

    $("#m1-audio_player-audio3-player").jPlayer("setMedia", { mp3: NEWURL });
    $("#m1-audio_player-audio3-player").jPlayer("play");

    to:

    $("#m1-<your-screenName>-<audioWidgetID>-player").jPlayer("setMedia", { mp3: NEWURL });
    $("#m1-<your-screenName>-<audioWidgetID>-player").jPlayer("play");
    #337068

    pbixdesign
    Member

    Hi octavio!! 🙂

    Thanck you !!

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: use a dynamic URL for mobione Audio Player?

You must be logged in to post in the forum log in