LAMP Tutorials
Lamp Tutorials Contact CrackFeed

How to use HTML5

Authored on: August 2, 2011 by Jeffery Dilegge

Digg this tutorial!

Please support Crackfeed with a small donation.

Back to HTML5 Tutorials




In the past, webmasters had to embed videos into webpages using javascript, flash, quicktime, etc. The problem is that the end user had to install third party browser plugins to be able to watch videos online. Now with the release of the HTML5 video element, webmasters have a browser accessible video embedding method. The HTML5 video element is still young and only works with top browsers like Firefox 3.5+, Andoid 2+ and IE 9+ to name a few. However, the accessibility is growing. For the time being, it is wise to stick with those third party plugins until video format accessibility improves for the HTML5 video element.

Supported Video formats

As you see, video format comatibility is still an issue. So, browser detection is still required unless you require your users to choose the embed page based on the browser they use.

  • Ogg   Supported by: Firefox 3.5, Opera 10.5 and Chrome 5.0
  • Mpeg4   Supported by: Opera 10.5, Internet Explorer 9.0 and Safari 3.0
  • WebM   Supported by: Firefox 4.0, Opera 10.6 and Chrome 6.0

How to embed videos into webpages using HTML5

This example tells the browsers 3 different video formats. So the browser will choose the first video format that it can work with. I also included the attribute "controls" that will display the video controls (Play, Pause, Rewind, and so on.)

<video width="320" height="240" controls="controls">
  <source src="movie.ogg" type="video/ogg" />
  <source src="movie.mp4" type="video/mp4" />
  <source src="movie.webm" type="video/webm" />
  Your browser does not support the video tag.
</video>

HTML5 video element attributes chart

Attribute Value Example
 
Audio muted audio="muted"
 
Autoplay autoplay autoplay="autoplay"
 
Controls controls controls="controls"
 
Height height in pixels height="380px"
 
Loop loop loop="loop"
 
Poster url to image sample of video poster="http://mysite.com/video.png"
 
Preload preload preload="preload"
 
Src url to video file src="http://mysite.com/video.avi"
 
Width width of video in pixels width="380px"

Links Directory | Jeffery Dilegge