HTML5 Audio: preload
preload is an attribute of the audio tag in HTML5. There are three possible values, as illustrated in these examples:
<audio preload="auto"></audio>
<audio preload="metadata"></audio>
<audio preload="none"></audio>
<audio preload="metadata"></audio>
<audio preload="none"></audio>
Here's what they mean:
Value | Description |
auto | Load the entire audio file as soon as the page loads. |
metadata | Load only metadata as soon as the page loads. |
none | Do not load the audio file or any metadata until the user presses play. |
Notes:
- The values are hints for the browser, not absolute commands. In other words, they are a suggestion for how the browser should behave. The browser may or may not follow the hint so don't be surprised if it doesn't always work.
- Preload is ignored if autoplay is on.
Author: Dave Owen, Originally published: 2012-08-10