javascript - AppMobi, html5 sound working on simulator and android but not in iphone -


today started in appmobi. developing small example deal sounds.

i needed create handler play , stop many sounds.

var audioon = new audio('sounds/11.mp3');  audioon.play(); 

this code working in xdk simulator, on android devices, not in iphone 5.

the thing is, if use tag works on iphone, want use javascript native api deal sounds , more.

i have been trying deal with appmobi player library comes without controls stop, resume etc, thats way want use native.

here part of javascript code :

<script type="text/javascript"> /* function runs once page loaded, appmobi not yet active */ var init = function(){ var alarmbutton = document.getelementbyid("alarmbutton"); var on = false; //var audioon = new audio('http://rpg.hamsterrepublic.com/wiki-images/3/3e/heal8-bit.ogg');  var audioon = new audio('sounds/11.mp3');  audioon.addeventlistener('ended', function() { this.play(); }, false);  var = function(){ alert("but"); alert(on); alert(audioon);  if(!on){ on = true; audioon.currenttime = 0; audioon.play();  } else{ on = false; audioon.pause();  } } //alarmbutton.addeventlistener("click",but,false); alarmbutton.addeventlistener("touchstart",but,false); alarmbutton.addeventlistener("tap",but,false);  };  window.addeventlistener("load",init,false);  /* code prevents users dragging page */ var preventdefaultscroll = function(event) { event.preventdefault(); window.scroll(0,0); return false; }; document.addeventlistener('touchmove', preventdefaultscroll, false);  /* code used run appmobi activates */ var ondeviceready=function(){ //size display 768px 1024px appmobi.display.useviewport(768,1024); //hide splash screen appmobi.device.hidesplashscreen();  };  document.addeventlistener("appmobi.device.ready",ondeviceready,false);  function echo(){ alert("clicked"); }  </script> 

thanks lot

it seems not appmobi issue.

i think appmobi lab app iphone uses safari mobile run html5 tests.

so safari mobile affair.

it seems play() work when launched onclick event. see http://groups.google.com/group/iphonewebdev/browse_thread/thread/91e31ba7ae25e6d4?hl=en

need perform tests...


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -