HTML video Tag

How to add video to your HTML web page

HTML provides <video> tag to embed video in your web page. It's a paired tag so you need to add both opening and closing video tags.

Within video tag, <source> tag is used to provide source of video using src attribute. type attribute specifies type of video file.

Example:
<video>
<source src="nature.mp4" type="video/mp4">
</video>

This tag is compatible with MP4, WebM, and Ogg file types. To avoid video codecs and browser compatibility issues, it's best that you add multiple sources to the video. If the browser cannot show the video, it will display the text you write between them.

<video> Tag Attribute:

controls
specifies whether the video should have player control buttons (play, pause, volume, etc.).

<video controls>
<source src="nature.mp4" type="video/mp4">
</video>

poster 
specifies whether a certain image will be shown while the video is loading like thumbnail in YouTube videos.

<video controls poster="image.jpg">
<source src="nature.mp4" type="video/mp4">
</video>

height and width
define the size of video player window in we page.

<video controls poster="image.jpg" width="400" height="300">
<source src="nature.mp4" type="video/mp4">
</video>

YouTube video link:


Comments

Popular Posts

How to Import and Export Delimited Files, like CSV, in PowerShell

PowerShell Arithmetic Operators

How to generate a GUID in PowerShell