The <video> element, new with HTML5, can be used to play video files in an HTML file/website.
<video width="480" height="360" controls>
<source src="file-name.mp4" type="video/mp4">
Any text inside this element will be shown on browsers that do not support this element...
</video>
The video formats supported (by most browsers, but at least by the element) are:
MP4 (video/mp4)The attributes for the video element can be used in the opening video tag to specify various playing options:
Control | Description |
---|---|
autoplay | Specify If Audio Should Play Automatically After Loading |
controls | Specify If Audio Controls Should Be Displayed |
height | Set the Player Height In Pixels |
oop | Specify If the Audio Should Start Over When Finished |
muted | Specify If Audio Should Be Muted by Default |
poster | Specify the URL of Image Shown Until Video Is Played |
preload | Use auto, metadata, or none to Specify How the Audio Should be Pre-Loaded |
src | Specify URL of Video File |
width | Set the Player Width In Pixels |
The <embed> tag can be used to embed external/interactive content in an HTML file/website.
<embed src="file-name.swf">
The attributes for the embed tag can be used to specify a few details about the embedded file:
Control | Description |
---|---|
height | Set the Player Height In Pixels |
src | Specify URL of Video File |
type | Specify Content's Media Type |
width | Set the Player Width In Pixels |
The <track> tag can be used to specify subtitles, captions, and other text files that should be displayed in conjunction with media while it plays.
Many sites such as YouTube make your job easier by providing a line of code for each video (as long as the owner of the video allows this feature) that you can copy and paste directly into your HTML document, without modifying, in order to embed a video on your webpage.
Now you can add as many cute little puppy and kitten videos to your site as you want!