Audio and video can make a web page more expressive and alluring. We can easily add an audio file by <AUDIO> tag and a video file by <VIDEO> tags in an HTML document.
Adding an audio file: <Audio> tag will be used to add sound to our web pages.
Syntax to use <AUDIO> tag is as follows:
<AUDIO CONTROLS>
<Source SRC="Name and path of the audio file" TYPE = "AUDIO/WAV">
</AUDIO>
For Example:
<html>
<body>
<Audio Controls>
<source src = "C:\Users\Public\Music\Sample Music\Sleep Away.mp3" type="audio/wav">
</Audio>
</body>
</html>
Try yourselfOutput |
Adding an video file: <Video> tag will be used to add a video to our web page.
Syntax to use <VIDEO> tag is as follows:
<VIDEO CONTROLS>
<Source SRC="Name and path of the video file" TYPE = "VIDEO/MP4">
</VIDEO>
For Example:
<html>
<body>
<Video Controls>
<Source src="C:\Users\asd\Downloads\nature.mp4"
type="video/mp4">
</Video >
</body>
</html>