Friday, February 23, 2018

Audio and video tag in html

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:

<audio>
                            <source src=""></source>
</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>

 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,
<audio controls>
                            <source src=""></source>
                   </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:   
<video controls>
                            <source src="video.mp4"></source>
                   </video> 


Tag: Audio and video tag in HTML,HTML,web design


No comments:

Post a Comment

Freelancing Website

Top online Earning or Freelancing Website 1. https://creativemarket.com/                 Graphics and Photography Related Site ...