1 Reply Latest reply on Jun 5, 2014 8:47 AM by btaartdirector

    How to play Audio on iOS device (iPhone/iPad) using HTML5

    stnaga

      I am using Adobe Edge Animate to create an HTML5 site that plays audio using JavaScript on an onclick() event.

       

      In my html I have the following between my <SCRIPT> tags:

      function aud_play_pause(filename) {

        var myAudio = document.getElementById(filename);

        if (myAudio.paused) {

          myAudio.play();

        } else {

          myAudio.pause();

        }

      }

       

       

      In my <BODY> I have:

      <audio id="sound">

                <source src="media/sound.mp3" type="audio/mpeg" />

                <source src="media/sound.ogg" type="audio/ogg" />

      </audio>

       

      In Adobe Edge Animate, I have an onclick event:

      aud_play_pause("sound");

       

      This works on IE, Chrome, and Safari. It also works on Safari when accessed by an iPhone.

       

      When I attempt to package the application with PhoneGap and deploy on a device, no sound is played. My application works perfectly with the exception of sound.

       

      Can someone guide me to a link that has instructions on how to play sound in HTML5 so that it works when deployed on an iPhone or iPad?

       

      Thank you,

        • 1. Re: How to play Audio on iOS device (iPhone/iPad) using HTML5
          btaartdirector Level 1

          I am having a similar issue, but using InDesign CC to make a DPS package. I have used user events like mouseover, mouseclick, to get the sound to play since apparently iOs will not allow autoplay of audio due to bandwidth and the appropriate-ness of audio playing without the user consenting. I am still no closer to getting the sound to play. It works fine in all other scenarios, but not on iOS.

           

          I hope someone can steer us in the right direction. Not a lot of "NEW" discussion on it past AN2.0.