How to define the URL of the video file in HTML5 ?
In this article, we will learn how to define the URL of a video in HTML. The <video> tag is used to embed video files on a web page. This displays a video player along with the player controls depending on the browser. The source of the video can either be a singular one or it can be made to support multiple formats of the video so that multiple browsers support the video playback.
Approach: The <video> tag has an attribute src which is used to specify the path from where the video file would be loaded. When multiple sources are to be specified, the src attribute can also be used with each of the <source> tags to define the path of that source video file. We will use this attribute to define the URL of the video file.
<video> <source src="path_to_video.mp4" type="video/mp4"> <source src="path_to_video.ogg" type="video/ogg"> </video>
Example 1: In this example, the attribute is used with the <video> tag. It illustrates the src attribute to define the URL of the video files.
Example 2: In this example, the attribute is used with the <source> tag to define multiple video sources.
Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML course.