0 Replies Latest reply on Mar 19, 2013 11:39 AM by Project Cog

    Loading audio into Adobe Edge via XML issue

    Project Cog

      I am having an issue linking the location of an audio file via XML in Adobe Edge. I am able to get the info and post it as text, however I can not get it to load into the audio player. This is my first try at code ever, nothing too complex if possible.

      Here is the code that works along with the part I can not get to work.

       

      var fromName;
      var outputField = $(this.lookupSelector("xmlOutput"));

      $.ajax({   
          type: "GET",
          url: "edgesound.xml",
          dataType: "xml",

          success: function(xml) {
              fromName = $(xml).find('audio1').text();       
              outputField.html(fromName);    
                          }
          });

          var newSound = new Audio();    
           newSound.src = "sound.mp3";
           newSound.volume = 0.5;

           sym.$("soundBtn").toggle(
      function(){
           newSound.play();
           sym.$(this).html('stop'); },
      function(){
           newSound.pause();
           sym.$(this).html('restart'); });

      // XML Try below   
           var newSound_xml = new Audio();    
           newSound_xml.src = "fromName";
           newSound_xml.volume = 0.5;

           sym.$("soundBtn_xml").toggle(
      function(){
           newSound_xml.play();
           sym.$(this).html('stop'); },
      function(){
           newSound_xml.pause();
           sym.$(this).html('restart'); });

       

      And here is the simple XML doc being called

          <?xml version="1.0" encoding="utf-8"?> <ax>  <audio1>sound.mp3</audio1>  </ax>

      I've also tried taking the .mp3 out of the xml and trying the following in the code with no success.

      newSound_xml.src = "fromName" + ".mp3";

      Thank you and here is a link to demo what I have so far.

      http://www.projectcog.com/audio/xml_audio.html