xm:lab

 English |  Español |  Français |  Italiano |  Português |  Русский |  Shqip

Open Video Workbook - Archived April 29th

Hands on - Including video in HTML5

Objective
Learn how to include video in a web page the open standard way with HTML5
 
Background: <video> in HTML5
 
The possibility to include images via the <img> tag in HTML pages was added in 1993. Many years later, discussions started about adding video support, which have now resulted in the <video> tag as part of HTML5. HTML5 is a set of new tags and functions for HTML that has been in active development since 2008 [http://en.wikipedia.org/wiki/Html5]. Open-source web browsers were the first to explore running audio and video on their own, inside new <audio> and <video> tags. This makes it possible to access and edit the media directly, make your page interact with the video, create different-shaped frames, and many other cool tricks.
 
Once you have video files that are ready to go online (find out more about encoding for web here [http://diveintohtml5.info/video.html#video-codecs]), you can include them via the <video> tag in your HTML5 page like so:
 
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset=utf-8 />
    <title>My Web Page</title>
  </head>
  <body>
    <h1>Welcome</h1>
    <p>This is my first web page, featuring an image.</p>

    <video height="180" width="300" id="ourvideo" controls>
    </video>

  </body>
</html>


 
Task
Have a look at the this page at: http://jsbin.com/agecem/latest and hit 'Edit in JS Bin' again to access the source. See how the <video> tag has the attributes "height" and "width", set to 180 and 300 pixels respectively? Change the values between quotes to modify the dimensions of the video element. Try making the video twice the size. Got it showing up correctly in the preview on the right? Cool! You are getting in control of your video the HTML5 way!

There has been error in communication with Booktype server. Not sure right now where is the problem.

You should refresh this page.