Level no.7
Lecture no.7
How to upload video in html ?
As usual tag is used, So we used video tag. In this tag multiple attributes are used. Controls, Src, Loop, Width, Height, Mute, Auto play are attributes. Lets learn how to use them. Src stand for Source. it is not compulsory to use alt attribute in video tag.
Code:
<video src="link of a video" > </video>.
In this src specifies thr URL of the video.
Example:
<!DOCTYPE html>
<html>
<head>
<title> Uploading video </title>
</head>
<body>
<p>
<video src="Cooking.mp4 " controls ></video>
</p>
</body>
</html>
In this example controls is used to display video such play/pause button etc.
Output:
Video will displayed
____________________________________________________
Code with Loop Attribute:
<!DOCTYPE html>
<html>
<head>
<title> Uploading video </title>
</head>
<body>
<p>
<video src="Cooking.mp4 " controls loop ></video>
</p>
</body>
</html>
In this the loop attribute plays video start over again, every time it get finished.
_______________________________________________________
Code with Muted Attribute:
<!DOCTYPE html>
<html>
<head>
<title> Uploading video </title>
</head>
<body>
<p>
<video src="Cooking.mp4 " controls muted ></video>
</p>
</body>
</html>
In muted attribute the audio of video is muted.
____________________________________________________
Code with Autoplay Attribute:
<!DOCTYPE html>
<html>
<head>
<title> Uploading video </title>
</head>
<body>
<p>
<video src="Cooking.mp4 " controls autoplay ></video>
</p>
</body>
</html>
In this attribute the start playing as soon as it is ready.
_________________________________________________________
Code with Height Attribute:
<!DOCTYPE html>
<html>
<head>
<title> Uploading video </title>
</head>
<body>
<p>
<video src="Cooking.mp4 " controls height="150 "></video>
</p>
</body>
</html>
This attribute sets te height of the video.
________________________________________________________
Code with Width Attribute:
<!DOCTYPE html>
<html>
<head>
<title> Uploading video </title>
</head>
<body>
<p>
<video src="Cooking.mp4 " controls width ></video>
</p>
</body>
</html>
This attribute sets the width of the video.
Point to Remember:
We can use loop, muted and auto-play attribute together, and Controls is must use in video. Controls basically starts the video.
Comments
Post a Comment