The best HTML5 Audio (Audio) Tutorial In 2024, In this tutorial you can learn Audio on the Internet,Browser Support,HTML5 Audio - How It Works,Examples,Audio formats and browser support,MIME type of audio format,HTML5 Audio tag,
HTML5 provides a standard play audio files.
Until now, still does not exist a program to play audio standard on the web.
Today, most audio through the plug-ins (such as Flash) for playback. However, not all browsers have the same plugins.
HTML5 provides embedded audio standard elements on the page, using <audio> element.
Internet Explorer 9+, Firefox, Opera, Chrome, and Safari support the <audio> element.
Note: Internet Explorer 8 and earlier versions of IE do not support the <audio> element.
To play audio in HTML5, you need to use the following code:
property for added control play, pause and volume control.
In the <audio> and </ audio> between you need to insert your browser does not support the prompt text <audio> element.
<Audio> element allows the use of multiple <source> element. <Source> elements can link to different audio file, the browser will use the first supported audio files
Currently, <audio> element supports three audio formats: MP3, Wav, and Ogg:
浏览器 | 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> | It defines audio content |
<source> | Provides multimedia resources, it may be more than one, use the <video> and <audio> tag |