HTML5 Audio (audio)

HTML5 provides a standard for playing audio files.

Audio on the internet

Until now, there is still no standard for playing audio on web pages.

Today, most audio is played through plugins such as Flash. However, not all browsers have the same plugin.

HTML5 specifies the standard for embedding audio elements on web pages, using the <audio> element.

Browser support



The <audio> element is supported in Internet Explorer 9+, Firefox, Opera, Chrome, and Safari.

Note : The <audio> element is not supported in Internet Explorer 8 and earlier versions of IE.

HTML5 Audio - How it works

To play audio in HTML5, you need to use the following code:

The control property is used to add play, pause, and volume controls.

Between <audio> and </audio> you need to insert the prompt text of the <audio> element that is not supported by the browser.

The <audio> element allows multiple <source> elements. The <source> element can link different audio files and the browser will use the first supported audio file.

Audio format and browser support

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   NO


MIME type of audio format

    format     MIME-typ e
    MP3Audio/mpeg
    OggAudio/ogg
    WavAudio/wav


HTML5 Audio tag

     label     Attributes
    <audio>Defined sound content
    
    <source>
Prescribed multimedia resources, can be multiple, used in the <video> and <audio> tags




Last Updated: 2018-07-06 12:32:44 By akshay

SHARE THIS

share_facebook share_twitter share_google_plus

Please Comment Here :