html audio tag

Home > HTML5 Tutorial > html audio tag

Best PHP Live Project Based Winter Training in Noida for more details click here



How to Use Audio Tag in HTML

Why this Audio tag is utilized in HTML? This component is utilized to implant sound substance in the documents. It might contain different sound sources, spoke to utilizing the src characteristic or the

 

component: the program will pick the most reasonable one. It can likewise be the goal for gushed media, utilizing a MediaStream.

 

 

 

<audio controls="controls">
  Your browser does not support the <audio> tag. 
  <source src="audio/sample.mp3" /> 
</audio> 

 

 

 

The above model shows straight forward utilization of the "audio" component. Along these lines to the component, we incorporate a way to the media we need to implant inside the src property; we can incorporate different ascribes to determine data, for example, regardless of whether we need it to autoplay and circle, whether we need to demonstrate the program's default sound controls, and so on.

 

 

 

Programs don't all help a similar sound arrangements; you can give various sources inside settled

 

 

components, and the program will at that point utilize the first it gets it.

 

 

 

<audio controls>
  <source src="myAudio.mp3" type="audio/mpeg"> 
  <source src="myAudio.ogg" type="audio/ogg"> 
  

 

Your browser doesn't support HTML5 audio. Here is a link to the audio instead.

 

</audio>

 

Audio formats and Webbrowser support When using the "audio" tag, you have to guarantee that your sound document is in the correct organization. There are three acknowledged arrangements which incorporate MP3, Ogg, and WAV. The table beneath shows which Internet programs bolster which record position.

 

 

 

WebBrowser MP3(MOVING PICTURE EXPERTS GROUP PHASE 3) Ogg WAV
Chrome Yes Yes Yes
Internet Explorer Yes No No
Safari Yes No Yes
Opera Yes Yes Yes

 


Inside a HTML tag, a quality directs certain parts of a HTML component. Traits are comprised of a name and worth pair; all labels bolster standard qualities. The accompanying table demonstrates the majority of the present one of a kind HTML properties for the "audio" tag, just as a depiction of each. Attribute: Description
autoplay: Designates that the audio file will play immediately after it loads.
controls: Designates what controls to display with the audio player.
loop: Designates that the audio file should continuously repeat.
muted: Designates that the audio file should be muted.

preload Designates how and when the audio file should load. src Designates the URL of the audio file.

 

Compatibility

 

 

 

Edge Internet Explorer Firefox Safari Opera Chrome
9.0+ 8.0+ 3.5+ 4.0+ 10.5+ 4.0+