TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

HTML Audio

HTML audio or html 5 audio tag with examples, forms, input, text, anchor, image, heading, marquee, textarea, paragraph, title, quotes, code etc.

<< Back to HTML

HTML Audio Tag

HTML audio tag is used to define sounds such as music and other audio clips. Currently there are three supported file format for HTML 5 audio tag.

  1. mp3
  2. wav
  3. ogg

HTML5 supports <video> and <audio> controls. The Flash, Silverlight and similar technologies are used to play the multimedia items.

This table defines that which web browser supports which audio file format.

Browsermp3wavogg
ie browser Internet Exploreryesnono
chrome browser Google Chromeyesyesyes
firefox browser Mozilla Firefoxyes*yesyes
opera browser Operanoyesyes
safari browser Apple Safariyesyesno

HTML Audio Tag Example

Let's see the code to play mp3 file using HTML audio tag.

<audio controls>
  <source src="koyal.mp3" type="audio/mpeg">
Your browser does not support the html audio tag.
</audio>
Test it Now

Output:

Let's see the example to play ogg file using HTML audio tag.

<audio controls>
  <source src="koyal.ogg" type="audio/ogg">
Your browser does not support the html audio tag.
</audio>

Supporting Browsers

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
<audio>YesYesYesYesYes

Attributes of HTML Audio Tag

There is given a list of HTML audio tag.

AttributeDescription
controlsIt defines the audio controls which is displayed with play/pause buttons.
autoplayIt specifies that the audio will start playing as soon as it is ready.
loopIt specifies that the audio file will start over again, every time when it is completed.
mutedIt is used to mute the audio output.
preloadIt specifies the author view to upload audio file when the page loads.
srcIt specifies the source URL of the audio file.

HTML Audio Tag Attribute Example

Here we are going to use controls, autoplay, loop and src attributes of HTML audio tag.

<audio controls autoplay loop>
  <source src="koyal.mp3" type="audio/mpeg"></audio>
Test it Now

MIME Types for HTML Audio format

The available MIME type HTML audio tag is given below.

Audio FormatMIME Type
mp3audio/mpeg
oggaudio/ogg
wavaudio/wav
Next TopicHTML video




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf