title: Html5 audio doesn't play in Cordova App
body: <p>I'm working on a legacy codebase which is a jquery app running a skinned version of pacman. The background audio works fine but the sound effects do not. I suspect there is a special permission to put into config.xml but haven't been successful.</p>
  
  <p>Can anyone point out why ios wouldn't be playing sound effects, even though the audio files are loaded from the same directory? Please let me know what other parts of code might be helpful.</p>
  
  <p>Thank you very much.</p>
  
  <p>Here's the config.xml:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;widget id="de.grammatidis.battle" version="1.0.2" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0"&gt;
      &lt;name&gt;Battle&lt;/name&gt;
      &lt;description&gt;Vorsicht, die rasenden Beißerchen haben es auf dich abgesehen! Flüchte so schnell du kannst mit dem Grammatidis-Männchen vor den wilden Zahngeistern und sammle dabei Punkte! 
      &lt;/description&gt;
      &lt;author email="kontakt@biloba-it.de" href="http://www.biloba-it.de"&gt;
          Biloba IT
      &lt;/author&gt;
      &lt;content src="index.html" /&gt;
      &lt;plugin name="cordova-plugin-whitelist" spec="1" /&gt;
      &lt;access origin="*" /&gt;
      &lt;allow-intent href="http://*/*" /&gt;
      &lt;allow-intent href="https://*/*" /&gt;
      &lt;allow-intent href="tel:*" /&gt;
      &lt;allow-intent href="sms:*" /&gt;
      &lt;allow-intent href="mailto:*" /&gt;
      &lt;allow-intent href="geo:*" /&gt;
      &lt;platform name="android"&gt;
          &lt;allow-intent href="market:*" /&gt;
      &lt;/platform&gt;
      &lt;platform name="ios"&gt;
          &lt;allow-intent href="itms:*" /&gt;
          &lt;allow-intent href="itms-apps:*" /&gt;
      &lt;/platform&gt;
      &lt;plugin name="cordova-plugin-device" spec="~1.1.0" /&gt;
      &lt;plugin name="cordova-plugin-inappbrowser" spec="~1.1.0" /&gt;
      &lt;plugin name="cordova-plugin-media" spec="~1.0.1" /&gt;
      &lt;plugin name="cordova-plugin-network-information" spec="~1.1.0" /&gt;
  &lt;/widget&gt;
  </code></pre>
  
  <p>Here's the audio.js</p>
  
  <pre><code>var Sound = function(game) {
      this.files          = {}; 
      this.loaded         = {};
      this.paths          = {};
      this.loop           = {};
      this.playing        = [];
      this.stopped        = [];
      this.playingIndex   = {};
      this.game = game;
      this.volume = 1;
      this.disabled = game.getSetting("soundDisabled") == "true" ? true : false;
      this.multiple = ["snd_eat","snd_eatghost"];
      this.backgroundSounds = ["original","elektro","dance","rock","pop","kids"];
      this.interval       = {};
  };
  
  Sound.prototype.load = function(name, path, realload, callback) {
      console.log('Sound.prototype.load');
      var _self = this;
  
      //save the path
      this.paths[name] = path;
  
      if(_self.loaded[name] == true) {
          if(callback) callback();
      } else {
          if(realload) {
              //load the audio file
              _self.files[name] = new Media(path,
                  function(){},
                  function(){},
                  function(status){
                      //check if done
                      if(status == 4 &amp;&amp; _self.stopped.indexOf(name) == -1) {
                          if(_self.loop[name] == true) {
                              _self.files[name].play();
                          } else {
                              var i = _self.playing.indexOf(name);
                              if(i != -1) {
                                  _self.playing.slice(i,1);
                              }
                          }
                      }
                  });
  
              //set the loaded flag
              _self.loaded[name] = true;
              if(callback) callback();
  
          } else {            
              _self.loaded[name] = false;
              if(callback) callback();
          }
      }
  };
  
  Sound.prototype.toggleSound = function() {
      console.log('Sound.prototype.toggleSound');
  
      if(this.disabled) {
          this.enableSound();
      } else {
          this.disableSound();
      }
  };
  
  Sound.prototype.enableSound = function() {
      console.log('Sound.prototype.enableSound');
  
      this.disabled = false;
      this.game.saveSettings("soundDisabled", "false");
      if(this.game.getSetting("music") == "original") {
          this.play(this.game.getSetting("music"), false, 0.2);
      } else {
          this.play(this.game.getSetting("music"), true, 0.2);
      }
  };
  
  Sound.prototype.disableSound = function(callback) {
      console.log('Sound.prototype.disableSound');
  
      var _self = this;
      this.disabled = true;
      this.game.saveSettings("soundDisabled", "true");
  
      for (var i = 0; i &lt; this.playing.length; i++) {
          _self.stop(this.playing[i]);
      }
      this.playing = [];
      if(callback) callback();
  };
  
  Sound.prototype.isDisabled = function() {
      return this.disabled;
  };
  
  Sound.prototype.isLoaded = function(name) {
      console.log('Sound.prototype.isLoaded');
  
      var _self = this;
  
      var i = _self.playingIndex[name];
      if(i === undefined || i == null) i = 1;
      _self.playingIndex[name] = i;
  
      return (_self.loaded[name] == true) || (_self.multiple.indexOf(name) != -1 &amp;&amp; _self.loaded[name + "_" + i] == true);
  };
  
  Sound.prototype.play = function(name, loop, volume, callback) {
      console.log('Sound.prototype.play');
  
      var _self = this;
  
      function doPlay() {
          //remove from the stopped list
          var i = _self.stopped.indexOf(name);
          if(i != -1) {
              _self.stopped.slice(i,1);
          }
  
          //add to the playing list
          if(_self.playing.indexOf(name) == -1) _self.playing.push(name);
  
          //check if the sound can be played multiple times
          if(_self.multiple.indexOf(name) != -1) {
              var i = _self.playingIndex[name];
              if(i === undefined || i == null) i = 1;
              i++;
              if(i &gt; 5) i = 1;
              _self.playingIndex[name] = i;
              name = name + "_" + i;
          }
  
          //set the volumen
          if(volume !== undefined) {
              _self.files[name].setVolume(volume);
          } else {
              _self.files[name].setVolume(_self.volume);
          }
  
          _self.files[name].play();
          _self.loop[name] = loop;
  
          if(loop) {
              var duration = _self.files[name].getDuration();
              if(duration != -1) {
                  _self.interval[name] = setInterval(function(){
                      _self.files[name].play();
                  }, (duration+10) * 1000);
              }
          }
      }
  
      var blnPlay = true;
      if(Platform.isApp() &amp;&amp; this.isBackgroundSound(name) == false) blnPlay = false;
  
      if(this.disabled == false &amp;&amp; blnPlay == true) {
          if(_self.isLoaded(name)) {
              doPlay();
              if(callback) callback();
          } else {
              _self.load(name, _self.paths[name], true, function(){
                  doPlay();
                  if(callback) callback();
              });
          }
      } else {
          if(callback) callback();
      }
  };
  
  Sound.prototype.stop = function(name) {
      console.log('Sound.prototype.stop');
  
      if(this.files[name] !== undefined) {
          this.stopped.push(name);
          if(this.interval[name] !== undefined){
              clearInterval(this.interval[name]);
          }
          this.files[name].stop();
      }
  };
  
  Sound.prototype.pause = function() {
      console.log('Sound.prototype.pause');
  
      for (var i = 0; i &lt; playing.length; i++) {
          this.files[playing[i]].pause();
      }
  };
  
  Sound.prototype.resume = function() {
      console.log('Sound.prototype.resume');
  
      for (var i = 0; i &lt; playing.length; i++) {
          this.files[playing[i]].play();
      }        
  };
  
  Sound.prototype.isBackgroundSound = function(snd) {
      console.log('Sound.prototype.isBackgroundSound');
  
      return (this.backgroundSounds.indexOf(snd) != -1);
  };
  </code></pre>