ScriptProcessorNode/JavaScriptNode iOS vs Android vs MAC OS ( Safari - Chrome)

Hello,


I have created an app in HTML 5 that generates white noise on its own using
a ScriptProcessorNode (Google Chrome) or a JavaScriptNode (Safari).

All is working fine for Google Chrome/Safari on my Mac and also in my
Android phone (not to mention that the performance is really bad on my
Xperia Acro S) but it is not working in Safari/Chrome on my iPod Touch 5th
on iOS 6.1.2.



The code is the following for initialization:



window.AudioContext = window.AudioContext || window.webkitAudioContext;

context = new AudioContext();





if(this.context.createScriptProcessor)

{

    jsProcessor = context.createScriptProcessor(512, 0, 2);

    alert("Chrome Desktop/Android");

}

else if(this.context.createJavaScriptNode)

{

      jsProcessor= context.createJavaScriptNode(512,1,1);

      alert("Safari");

     //adding 1 to node input make it works only for Safari on MAC

}

else

{

    alert("No way");

}


jsProcessor.onaudioprocess = generateWN;

gainNode = context.createGainNode();

jsProcessor.connect(gainNode);

gainNode.gain.value = 0.5;





I have a button on the screen that when it is touched the gainNode is
connected to context.destination or it's disconnected. I can see that
onaudioprocess event is not triggered on my iPod (iOS 6.1.2 Safari and
Chrome)...





What am I doing wrong? Is something different from Safari/Chrome on iOS
than for MAC that I am not considering?



I need to create sound samples on the fly... If this work I would add a
filter node to filter the white noise for generating other sounds as the
user wants.


Thanks!

-- 
Leonardo.

Received on Thursday, 3 October 2013 20:15:04 UTC