Advertisement
Home Open Editor ❯

HTML <audio> preload Attribute

Example

<audio controls preload="auto">
  <source src="cat.mp3" type="audio/mpeg">
  <source src="cat.ogg" type="audio/ogg">
  Your browser does not support the audio tag.
</audio>

Try this code ❯

Meaning

The preload attribute specifies what the author thinks the audio should be loaded when the page loads.

The default value is different for each browser. The w3 spec advises it to be set to metadata.

Note: The autoplay attribute has precedence over preload. If autoplay is specified, the browser would obviously need to start downloading the audio for playback.


Standard Syntax

<audio preload="auto|metadata|none"></audio>


Advertisement

Attribute Values

Value Description Example
auto The browser should load the entire audio file when the page loads <audio preload="auto">
metadata The browser should load only metadata when the page loads (e.g. length) <audio preload="metadata">
none The browser should NOT load the audio file when the page loads <audio preload="none">
empty string It is equal to auto <audio preload="">
Home Open Editor ❯
Advertisement