Reputation: 7288
was writing some script similar to piano, thats mean it should play sounds INSTANTLY when u tap/touch/click the button.
But the problem is that, its seems like it takes time ( which relatively alot ) to play each sounds once tap.
as it looks more like streaming which takes times to load :/
Is there any other approach I can use to achieve this ?
Thanks :D , (*for reading at least)
Upvotes: 0
Views: 1076
Reputation: 65835
Do this after DOMContentLoaded
:
yourAudioElement.play();
setTimeout(function(){
yourAudioElement.pause();
},1);
This will force iOS browser to cache the resources
Upvotes: 1
Reputation: 208002
Preloading <audio>
and <video>
on iOS devices is disabled to save bandwidth.
In Safari on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and autoplay are disabled. No data is loaded until the user initiates it.
Source: Safari Developer Library
Upvotes: 3