Note that there are some explanatory texts on larger screens.

plurals
  1. POAppMobi, html5 sound working on simulator and android but not in iphone
    primarykey
    data
    text
    <p>Today I get started in appmobi. I was developing a small example to deal with sounds.</p> <p>I just needed to create a handler to play and stop many sounds. </p> <pre><code>var audioOn = new Audio('sounds/11.mp3'); audioOn.play(); </code></pre> <p>This code is working in the xdk simulator, also on android devices, but not in my Iphone 5.</p> <p>The thing is, if I use tag it works on iphone, but I want to use javascript native api to deal with sounds and more.</p> <p>I have been trying to deal with it with appmobi player library but it comes without controls to stop, resume etc, thats way I want to use native.</p> <p>Here is part of javascript code :</p> <pre><code>&lt;script type="text/javascript"&gt; /* This function runs once the page is loaded, but appMobi is 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 but = 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); /* This code prevents users from dragging the page */ var preventDefaultScroll = function(event) { event.preventDefault(); window.scroll(0,0); return false; }; document.addEventListener('touchmove', preventDefaultScroll, false); /* This code is used to run as soon as appMobi activates */ var onDeviceReady=function(){ //Size the display to 768px by 1024px AppMobi.display.useViewport(768,1024); //hide splash screen AppMobi.device.hideSplashScreen(); }; document.addEventListener("appMobi.device.ready",onDeviceReady,false); function echo(){ alert("clicked"); } &lt;/script&gt; </code></pre> <p>Thanks a lot </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload