best way to preload audo and then play ?
ok I have my image.. that is shaking.. working on that in last post.. and I need to make the shaking
start right when audio plays.. or other way around.. just want them both to run at the same time..
so I had this code code to embed.. but it just plays when its ready
HTML Code:
<audio preload autoplay>
<source src="ElectFizzle.mp3" type="audio/mpeg">
<source src="ElectFizzle.OGG" type="audio/ogg">
<embed src="ElectFizzle.mp3">
</audio>
and now I'm trying the audio class.. but it doesnt ever play.. I do something wrong or really wrong.. or
should I just try something else ?
Code:
function SyncAudioVibrate() {
iStartPos=document.getElementById("Logo1").offsetLeft;
StartPos=iStartPos.toString()+"px";
var audio = new Audio();
audio.addEventListener('canplaythrough', LogoAction(audio), false);
audio.src = 'ElectFizzle.OGG';
}
function LogoAction(Myaudio) {
vibrate();
Myaudio.play();
}
ideas ?