Html5 audio tag will allow you to embed any audio clip in your webpage with just one line code, We often hear music online, simply by clicking start button on web page, here we learn how to add audio clip in html page.
If you want to add one audio clip in your webpage, Here is the syntax for adding single audio file in html page.
<audio src="~/sound/file1.mp3" controls="controls" />
In case, you want to add many audio files that keep on playing in loop, here is the syntax for adding multiple audio files in webpage.
<audio controls="controls" autoplay="autoplay" loop="loop"> <source src="~/sound/file1.mp3"> <source src="~/sound/file2.mp3"> </audio>
Here are few important attributes for audio
this property is for setting up the file source, like source
autoplay="autoplay" This Boolean attribute specifies that if the audio will automatically start playing, the value is "autoplay" which means "true".
controls="controls" , Indicates browsers will display the control, that will allow the user to control audio play/pause, volume etc.
loop="loop" Indicates that audio will automatically start over again.
muted="muted" , if the property value set to muted then, then the audio will be muted when loaded for the first time.
HTML5 is very demmanding skill for Web Designer, the newer version of html has introduced many new tags that helps creating rich experiences while user browsing any webpage on different devices.