title: HTML5 Audio play two sounds in IOS
body: <p>i want to play 2 sounds in ios and since it could not be done, i defined 2 audio objects.</p>
  
  <p>i start playing the first sound and when want to play the second, i pause the first and wait till the second end, then i resume playing the first from the point it reached.</p>
  
  <p>you can check the following code, if i remove the alert("test"); the first audio start playing from zero and so current time don't work!</p>
  
  <p>kindly help.
  Thanks,</p>
  
  <pre><code>var PlayedTime = 0; ; //in seconds
  var AudioObj;       
  var audioType = '.mp3';
  var isResume = false;
  $(document).ready(function () {
  
      if (!!AudioSound.canPlayType('audio/ogg') === true) {
          audioType = '.ogg' //For firefox and others who do not support .mp3
      }
  
      AudioObj = document.getElementById('AudioSound');
  
      document.getElementById('AudioSound').addEventListener('ended', function () {                
          resume();
      });
  });
  function play1() {
      AudioObj.src = "Images/Sound1" + audioType;
      AudioObj.load();           
  }
  function play2() {
      PlayedTime = AudioObj.currentTime;  
  
      AudioObj.pause();
      AudioObj.src = "Images/Sound2" + audioType;
      AudioObj.load();         
      AudioObj.play();
  }
  
  function resume() {            
      isResume = true;
      AudioObj.pause();
      AudioObj.src = "Images/Sound1" + audioType;
      AudioObj.load();            
  }
  
  function JumpAudio() {
      AudioObj.currentTime = 36;
  }
  function DataLoadedtoPlay() {
      AudioObj.play();
      if (isResume) {
          isResume = false;
          try {
              alert("test");
              AudioObj.currentTime = PlayedTime;
          }
          catch (e) {
              alert("catch");
          }
      }
  }
  
  
  &lt;div id="containerAud"&gt;
      &lt;audio id="AudioSound" onloadeddata="DataLoadedtoPlay()"&gt;&lt;/audio&gt;
  &lt;/div&gt;
  
  &lt;input type = "button" onclick="play1()" value="click1"/&gt;
  &lt;input type = "button" onclick="play2()" value="click2" /&gt;
  &lt;input type = "button" onclick="JumpAudio()" value="JumpAudio" /&gt;    
  &lt;/div&gt;
  </code></pre>