Friday, September 2, 2011

Configuring webserver for html5 video

When u are using HTML 5.0 video on your website, you need to remember that your webserver is configured to send the correct MIME–type with your file. If you don’t the browsers won’t recognize it and the video won’t play. You will see an X appearing on your video, and the video will not start playing when you click on it.

If u are using an Apache webserver, you can use the AddType directive in your side-wide httpd.conf or in the .htaccess file that is located in your directory where your videos are stored.

The following line should be added in that case:

AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm

When u are using an IIS server there are 2 possibilities. You can configure it on your IIS server, or you can add the MIME–types in your Web.config.

When you want to configure the MIME–types on your IIS server there are some differences between the versions.

Configuring MIME-Type for IIS 6.0
Configureer MIME-type for IIS 7.0

The other possibility is using your Web.config. This is ideal for developers who are use IIS Express and don’t have a full instance of IIS running. But beware, this is only supported when you are using IIS 7.0 or higher. The following section needs to be added in your configuration file:

      <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
      <mimeMap fileExtension=".webm" mimeType="video/webm" />
      <mimeMap fileExtension=".ogv" mimeType="video/ogv" />


  1. I strongly agree with your opinions toward Learn HTML5 and css3. You have to hope on it now so you do not get left behind.

  2. I agree! But I do consider HTML5 to be more than just the spec that the W3C validator checks your document against. Part of html5 media playerinvolves standards for bolt on technology including web workers, CSS3, server sent events, etc. that are going to (I hope) revolutionize the web and do away with the need for 3rd party browser plugins