Audio Tag And Video Tag

Audio Tag

The <audio> tag specifies a standard way to insert an audio file into a web page. It can be used in any format like mp3,ogg,wav, etc

Syntax:

<audio>

<source src=" sample.mp3" type="audio"/>

</audio>

Attributes:

  • Controls: Defines what controls to display with the audio player.

  • Autoplay: plays the audio file automatically when the web page is loaded.

  • Loop: Defines that the audio file should continuously repeat.

  • src: Defines the URL of the audio file.

  • muted: Defines that the audio file should be muted.

  • Example:

    <audio controls>

    <source src="podcast.mp3" type="audio.mp3" />

    </audio>

Video Tag

The <video> tag embeds a media player which supports video playback into the document.

Syntax:

<video>

<source src=" " />

</video>

Attributes:

  • Autoplay: It tells the browser to immediately start downloading the video and play it as soon as it can.

  • Preload: It intends to provide a hint to the browser about what the author thinks will lead to the best user experience.

  • Loop: It tells the browser to automatically loop the video.

  • height: It sets the height of the video in CSS pixels.

  • width: It sets the width of the video in CSS pixels.

  • Controls: It shows the default video controls like play, pause, volume, etc.

  • Muted: It mutes the audio from the video.

  • Poster: It loads an image to preview before the loading of the video.

  • src: It is used to specify the URL of the video file.

Example:

<video controls >
<source src="./C Language Tutorial for Beginners (with Notes & Practice Questions).mp4">
    </video>