HTML5 Audio(audio)
Audio on the Internet
Until now, there is still no such thing A standard designed to play audio on web pages.
Today, most audio is played through plug-ins (such as Flash). However, not all browsers have the same plugins.
HTML5 specifies a standard for embedding audio elements on web pages, using the <audio> element.
Browser support
Internet Explorer 9+, Firefox, Opera, Chrome, and Safari all support the <audio> element.
Note: Internet Explorer 8 and earlier IE versions do not support the <audio> element.
HTML5 Audio - How it works
To play audio in HTML5, you need to use The following code:
Example
<audio controls> <source src="音频文件名称" type="音频文件格式"> <source src="音频文件名称" type="音频文件格式"> 您的浏览器不支持 audio 元素。 </audio>
Audio format and browser support
Currently, the <audio> element supports three audio format files: MP3 , Wav and Ogg: NO
Chrome 6 +
Safari 5+ yes yes no
#11 10+ yes yes yes yes yes
## Autoplay AutoPlay If the attribute appears, the audio will be played immediately after ready. # Controls Controls If this attribute appears, it will display the control to the user, such as the play button. Loop Loop If this attribute appears, it will start playback at the end of the audio. Preload Preload If this attribute appears, the audio is loaded when the page is loaded, and it is prepared to play. If you use "AutoPlay", ignore the attribute. # SRC URL to play the audio URL. Next Section