insert audio in HTML

How can you insert an audio or music file into an HTML webpage?

Inserting a audio file in HTML file is quite easy now. You can include audio or music file through tag. <embed> tag's src attribute required the path of music or audio file which you want to include in webpage. Example is mentioned below: Example


<embed src="mymusic.mid" />
Above mentioned example appear different on your user's browser because it depends on the media player which is installed at user's computer.
Attribute Description
Width You can set width of media player. Syntax is mentioned below:

width="200"
Height You can set height of media player. Syntax is mentioned below:

height="200"
Hidden You can set hidden attribute's value true and false. If you do not want to show media player then set this attribute as true else false. Syntax is mentioned below:

Hidden='true' or Hidden='false'
Autostart Through this attribute you can start media player automatically after loading the webpage. If you set this attribute true then media player will start automatically, syntax is mentioned below:

Autostart='true'
If you do not want to start media player automatically set this attribute as false, syntax is mentioned below:

Autostart='false'
Loop If you want to repeat your audio or music file automatically after completing then set this attribute at 'true' else set as 'false'. Syntax is mentioned below:

Loop='true' or Loop='false'
Volume You can set default volume of your media file. You can set value between 0 - 100. Syntax is mentioned below:

Volume='60'

FAQ 1. Which attribute is used to specify the audio file location in the embed tag? The src attribute specifies the path or URL of the audio file. It tells the browser where the external audio resource is located. 2. Can I play an MP3 file using HTML? Yes, you can play MP3 audio files using HTML. The