How To Use HTML5 | Include Files | Video Tags | HTML5 Video Tutorial

How does html5 video tag makes the difference?

The <video> tag is one of the most exciting and awaited feature of HTML5, there is no doubt that this video tag would make adding and viewing much easier. When we visit Youtube we can find that there are links by the side of a video clip to embed it to another web-page. Actually, there is no magic in this technology, it simply plays the video through Adobe’s Flash files. There are several other third-party players like realplayer, Quicktime etc. The plug-ings to support them are usually already installed separately in your browser. You mite notice that in some old computers Youtube cannot play the video because Adobe Flash plug in is not installed. The new html5 <video> tag eliminates all this complexity and enables you to play the video files in any browser without having an additional plugin installed.

Creating a supported Video File to embed using html5 video tag.

Before starting off to learn how to use the markups for embedding video in html5, you should keep in mind that all browsers don’t support every file formats. There are quite a lot of video file formats existing today and its quite difficult to create the <video> tag which can support all of them together ( may be now you got the real reason why you should be excited about the <video> tag in the first place). Today, the support for specific formats vary from browser to browser. So first we’ve to learn to create a the video files in the format which are supported by the specific browser. The table shows specific formats supported by each browsers. Naturally, you would by having this question in mind “So the video files embedded using <video> tag doesn’t play in all browsers?”. Yes, there are techniques for this, but for the time being lets learn the basics.

Video Formats Subpported by Browsers for HTML5

Source

How to use the html5 tag?

There are two ways to embed a file in html5 <video> tag. Single and Multiple. If you have only one video file you can simply link it to the src attribute. It is just as same as displaying the image <img src=”…”>.

To display One Video

<video src=”hello.webm”></video>

To adjust size :

<video src=”hello.webm” width=”320” height=”240”></video>

This <video> element doesn’t include any sort of player controls. You can include them your own in attractive ways by using CSS and Javascrip. The <video> element has methods like play() and pause(). If you want the browser to display a default control just ask it to display the built-in set of controls.

<video src=”hello.webm” width=”320” heigh=”240” controls></video>


Displaying Multiple Video Files In HTML5

<video width="320" height="240" controls>

  <source src="hello.mp4"  type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>

  <source src="hello.ogv"  type='video/ogg; codecs="theora, vorbis"'> 

  <source src="hello.webm" type='video/webm; codecs="vp8, vorbis"'> 

</video>

Be The First To Share HTML5!

You can be the first to one to let your peer computer enthusiasts know about html5 by sharing this on facebook and twitter at the top of this page. Do post your comments and doubts on the topic, i'll soon clear it off and help you out!If you found this article helpful, you can 'vote me up' in the green oval below.

The benefit of this trouble is that only the format supported by the browser is played, the rest is not even downloaded. This is also one way to make your video play in any format. These are technically all the things you need to implement <video> tags in html5. Hope you liked the tutorial.

More by this Author


1 comment

rasta1 profile image

rasta1 4 years ago from Jamaica

I am looking into video publishing, It is so nice of you to do a third article.

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working