HTML VIDEO

In HTML, you can use the `<video>` element to embed and display video content on a web page. The `<video>` element provides a built-in video player with playback controls.


Here's an example of how to embed a video using the `<video>` element:

html
<video controls width="640" height="360">
    <source src="video.mp4" type="video/mp4">
    <source src="video.webm" type="video/webm">
    Your browser does not support the video tag.
</video>

In the above example, we have an HTML video player that includes two `<source>` elements. Each `<source>` element specifies the video source URL and its corresponding MIME type. This allows the browser to choose the supported video format. If none of the specified formats are supported by the browser, the text "Your browser does not support the video tag" will be displayed.

The `controls` attribute adds default playback controls to the video player, such as play, pause, and volume control. The `width` and `height` attributes set the dimensions of the video player. You can adjust these values to fit your desired size.


Additionally, you can include other attributes to customize the video player behavior:

- `autoplay`: The `autoplay` attribute automatically starts playing the video when the page loads.
- `loop`: The `loop` attribute makes the video replay continuously.
- `muted`: The `muted` attribute starts the video muted.
- `poster`: The `poster` attribute specifies an image to display as a placeholder before the video starts playing.


html
<video controls autoplay loop muted poster="poster.jpg" width="640" height="360">
    <source src="video.mp4" type="video/mp4">
    <source src="video.webm" type="video/webm">
    Your browser does not support the video tag.
</video>

In addition to these basic features, the `<video>` element provides JavaScript APIs that allow you to control playback, track progress, and respond to events. You can use these APIs to build custom video controls and create interactive video experiences.

Remember to provide multiple video formats (e.g., MP4, WebM) to ensure compatibility with different browsers and devices.



About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





 PreviousNext