Audio and video tag in html
Audio :
To adding a audio or video file we need to add audio or video tag in html file.
Audio Tag syntax:
<source src=""></source><audio>
</audio>
in html5 we need to write another tag in audio tag which is called source tag.In source tag we use src attribute to add audio file.
code example:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<audio>
<source src=""></source>
</audio>
</body>
</html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<audio>
<source src=""></source>
</audio>
</body>
</html>
but when we run it on browser we see blank window for.Because, we doesn't call audio control player yet. For that we need to add controls attribute in audio tag.
like,
<source src=""></source><audio controls>
</audio>
code example:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<audio controls>
<source src="audio.mp3"></source>
</audio>
</body>
</html>
Video tag:
video tag are same just replace audio tag by video tag
syntax:
<source src="video.mp4"></source><video controls>
</video>