HTML5 provides a standard for playing audio files. Until now, there is still no standard for playing audio on the web. Today, most audio is played through plug-ins such as Flash. However, not all browsers have the same plug-in. HTML5 specifies the standard for embedding audio elements on web pages, even with the < audio > element. Internet Explorer 9, Firefox, Opera, Chrome, and Safari all support Note: Internet Explorer 8 and earlier IE versions do not support To play audio in HTML5, you need to use the following code: In Currently, the audio element supports three audio format files: MP3, Wav, and Ogg: browser MP3 Wav Ogg Internet Explorer 9 + YES NO NO Chrome 6 + YES YES YES Firefox 3.6 + YES YES YES Safari 5 + YES YES NO Opera 10 + YES YES YES Format MIME-type MP3 Audio/mpeg Ogg Audio/ogg Wav Audio/wav Label Description < audio > Defines the sound content <source> Defined multimedia resources, which can be multiple and used in<video>and<audio>tags 11.39.1. Audio on the Internet ¶
11.39.2. Browser support ¶
<audio>
element。
<audio>
element。 11.39.3. HTML5 Audio-how to work ¶
Example ¶
<audiocontrols><sourcesrc="horse.ogg"type="audio/ogg">
<sourcesrc="horse.mp3"type="audio/mpeg">Your browser does not support
audio element.</audio>
control
Property for adding playback, pause, and volume controls.
<audio>
and
</audio>
you need to insert something that the browser does not support.
<audio>
the prompt text for the element.
<audio>
element allows you to use multiple
<source>
element。
<source>
elements can be linked to different audio files, and the browser will use the first supported audio file 11.39.4. Audio format and browser support ¶
11.39.5. MIME type of audio format ¶
11.39.6. HTML5 Audio tag ¶