HTML DOM Audio preload property
Examples
Once the page is loaded, it starts to load audio:
var x = document.getElementById("myAudio").preload;
x The output is:
none // 页面加载时,音频不加载
try it"
Definition and Usage
preload property sets or returns whether the page is loaded immediately after loading audio.
preload attribute describes whether preloading after page load audio.
Note: If you use the autoplay attribute the preload property is ignored.
Note: <audio> elements in HTML5 is new.
Browser Support
All major browsers support preload property.
Note: Internet Explorer does not support the preload property.
grammar
Back preload attributes:
audioObject .preload
Setting preload properties:
audioObject .preload="auto|metadata|none"
Property Value
值 | 描述 |
---|---|
auto | 指示一旦页面加载,则开始加载音频。 |
metadata | 指示当页面加载后仅加载音频的元数据。 |
none | 指示页面加载后不应加载音频。 |
technical details
return value: | String representing the preloaded data. May return values are "auto", "metadata", or "none". You can view the "attribute value" represents. |
---|
More examples
Examples
The following example demonstrates how to set different property values:
document.getElementById("myAudio").preload="none";
document.getElementById("myaudio").preload="auto";
document.getElementById("myaudio").preload="auto";
try it"
Related Pages
HTML Reference Manual: HTML <Audio> PRELOAD property
Audio Object