Audio and Video Tag run the audio and video files in our web pages without using a single line code.
Today Thousands of audio formats are existing in the world. But most of the formats are not supported by every Browsers. Most of the common internet browsers are support the following audio formats.
The <audio> element is used to play audio. The following is a sample example of the <audio> element.
In this example, the file GoldenSound.mp3 will play the page is loaded.
<audio controls="controls"><source src="https://tutorialathome.in/Demos/GoldenSound.mp3">GoldenSound /></audio>
<audio id="audio" controls="controls">
<source src="GoldenSound.wav" type='audio/wav; codecs="1"' />
<source src="GoldenSound.oga" type='audio/ogg; codecs="vorbis"’ />
<source src="GoldenSound.mp3" type='audio/mpeg; codecs="mp3"' />
</audio>
Here we provide the multiple audio format. The browser will choose the appropriate format which is more accurate for playing.
The <audio> element can be configured to customize its behavior as we need. The following attributes are configured.
A simple example for <video> tag in HTML 5
<p>
<video preload="auto" controls="controls" width="480" height="300">
<source src="http://tutorialathome.in/Demos/Cute.mp4" type="video/mp4" />
</video>
</p>
<video height="480" controls="controls" >
< source type='video/webm; codecs="vorbis, vp8"' src="tah.webm" />
<source type='video/ogg; codecs="theora, vorbis"' src="tah.ogv"/>
< source type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' src="tah.mp4"/>
</video>
Provide the multiple source of the video format. The browser will choose the appropriate format which is more accurate for playing.
The <video> element can be configured the behavior of the video player in our webpage. The following is the list of attributes you can use to configure for the <video> element.