Audio and Video Tag In HTML

Audio and Video Tag In HTML

How The Audio & Video Is Added To the Webpages???

·

2 min read

In HTML Blog We went through the Elements Which are used to embed images & another Html page in a webpage. Similarly in this blog, we are going to see how the audio and video are added to the webpage.

Audio Tag

An audio tag is used to embed the audio in webpage.

we have to use <audio> element to insert audio by specifying the Source of the audio file using src attribute.

Attributes that can be added to the Audio Tag :-

  • src : This is used to specify the path of the audio files.

  • controls : this attribute is used to provide the play/pause, volume & seek bar controls to the Audio element in the webpage.

  • autoplay : is used to play the audio automatically whenever the page is loaded without even clicking the play button.

  • loop : This is used to play the audio again and again in a loop.

  • mute : By using this the audio will be in muted condition.

<audio src="./assets/ABCD 2 Movie - Songs.mp3" controls autoplay muted> This The Song From ABCD 2 </audio>

Video Tag :

<video> tag is used to embed the video on website.

video tag has almost similar attributes to audio with only the addition of showing graphics as Video on a webpage.

Attributes that are additional in compassion with audio are :

  • preload : is used to get rid of buffering by this attribute the video element start loading while the page is loading.

  • poster : This is used to provide a thumbnail to the video.

  • width : is used to specify the width of the video player.

  • height : is used to specify the height of the video player.

      <video src="./assets/video.mp4" controls autoplay muted height="100" width="100"> </video>
    

Please add Your Valuable Suggestion