Advertisement

HTML <audio> tag

Examples

A simple piece of HTML 5 audio:

<audio src="someaudio.wav">
您的浏览器不支持 audio 标签。
</audio>

Try it yourself

Browser Support

IE Firefox Chrome Safari Opera

Internet Explorer 9+, Firefox, Opera, Chrome and Safari support the <audio> tag.

Note: 8 and earlier versions of Internet Explorer do not support the <audio> tag.

Definition and Usage

<Audio> tag defines sound, such as music or other audio streams.

HTML 4.01 and HTML 5 differences between

<Audio> tag is the new HTML 5 tags.

Tips and Notes

Tip: You can place the text between the start and end tags, like this old browser can display information does not support this tag.

Attributes

new: HTML5 new property.

Attributes value description
autoplay autoplay If this attribute is present, the audio is ready immediately after the play.
controls controls If this attribute is present, then displayed to the user control, such as a play button.
loop loop If this attribute is present, whenever the audio end start playing again.
muted muted Provisions of the video output should be muted.
preload preload

If this attribute is present, the audio loaded when the page is loaded and ready to play.

If you use the "autoplay", this property is ignored.

src url URL of the audio to be played.

Global Properties

<audio> tag supports HTML in the global properties .

Event Properties

<audio> tag supports HTML in the event properties .

Related Pages

HTML DOM Reference Manual: Audio Object