Hello all,
I would like to develop a musical percussion app for FF OS.
I have a prototype, which is basically a drum. I noticed a small yet
inconvenient delay between the physical tap on the device (PEAK) and the moment
that the corresponding function is actually triggered and the sound starts to
play. May be unnoticeable if using a convenient app but a show stopper when
playing a musical instrument.
Example code:
document.getElementById('drum1').addEventListener("touchstart", function(e)
{play('sound1');},false);
function play(x) {
var a,b;
b=new Date();
a=x+b.getTime();
playing[a]=new Audio(sounds[x]);
playing[a].load;
playing[a].onended=function(){delete playing[a]};
playing[a].play();
}
I am using no 3rd party libraries in this prototype.
Originally I thought that the delay is because of the new Audio() construct but
logging showed that the play() function actually lasts only about 2-3
milliseconds.
So now I suspect the delay is produced in the moment the physical tap happens
and FF OS passes it on to the app.
Any help is greatly app-reciated:-)
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g