I want to preload audio files in my website. I am using the following code in html page.
<embed src="cheer.swf" hidden="true" autostart=false style="height:0px; width:0px">
<embed src="click.swf" hidden="true" autostart=false style="height:0px; width:0px">
<embed src="doowip.swf" hidden="true" autostart=false style="height:0px; width:0px">
But still all the audio files are played at the beginning of the page. how can i stop the autoplay of audio files.
Also how can i preload the files for ipad safari?
<audio id="genclick" src="click.wav" type="audio/wav" >
<audio src="doowip.wav" type="audio/wav" >
<audio src="cheer.wav" type="audio/wav" >
the above code not loading the file until i play it from javascript..
document.getElementById("genclick").play();
where am I going wrong??
According to http://kb2.adobe.com/cps/127/tn_12701.html the parameter name you’re looking for (for the swf ’embed’ tags) is ‘play’, not ‘autostart’. Therefore, change them to:
You could also put them within object tags and then use:
I’ve tested this myself, and it works. As for the tags for iPad Safari, the HTML5 audio tag has an attribute called ‘preload’, which when set to ‘auto’ should preload the files as you want. Try:
I hope this helps.