I have multiple audio files in a web page. I want them all to be ready to be played as soon as the page is loaded, but it is too heavy and useless to entirely preload all of them at once. So I want to preload only a certain amount of the audio and load the rest iff they are played (similar to the behavior we see on YouTube par example).
How can I do this on a HTML5 page (possibly using Javascript)?