HTML5 Video Player logo
HTML5 Video Player for Mac and Windows

HTML5 Video MIME Types Setup on Apache and IIS Servers

Question: I love your HTML5 video player, easy to use and quick to publish HTML5 videos for my websites. Everything seemed to be in order when it was made, I can play the generated HTML5 videos locally without any problem. However, I am having trouble getting it to play on my websites?

We have talked about HTML5 video browser support on different browsers, such as HTML5 video in Internet Explorer 9, also Safari HTML5 Support on earlier posts. However HTML5 video display relies not only on local web browsers, in order to run HTML5 videos smoothly on remote websites, you have to make sure your web server supports HTML5 videos as well. HTML5 video MIME type plays a key role in rendering videos to HTML5 browsers. In this article, we will explain how to configure MIME types on web server to support the HTML5 videos on your websites.

MIME stands for Multi-purpose Internet Mail Extensions. MIME types form a standard way of classifying file types on the Internet. Web servers and browsers all have a list of MIME types, so that they can transfer files of the same type in the same way, no matter what operating system they are working in.

If you find that your video plays well on your local computer, but doesn’t play on live web server, it’s probably because the remote web server isn’t configured properly for your video format. You need to ensure your web server supports the MIME type of your video.

HTML5 Video MIME Types Setup on Apache and IIS Servers

A MIME type has two parts: a type and a subtype. They are separated by a slash (/). Let’s take the Video MIME Types for example, the MIME type for MP4 files is video and the subtype is mp4. Together, the complete MIME type for MP5 video is video/mp4.

If the video MIME type for a specific video format is not configured properly on your web server, your site visitors will not be able to play this type of videos on your web pages. That’s why video MIME type configuration is so important in playing online videos.

The future of the web is HTML5 with big change of online video standard by introducing the video element. However the HTML5 specification describes video support without specifying a particular video format. The most popular HTML5 videos are MP4, OGG and WebM. You can find more about HTML5 video here.

HTML5 Video MIME Types Setup on Apache and IIS Servers

Since there are different HTML5 video types, so what’s the proper MIME type? Firstly you must check out what videos you want to publish to your website, is it a mp4, ogv, webm, or you have them all? If you have all of them, we recommend you have all the formats or at least mp4 and webm for maximum browser compatibility, you will have to set MIME types for them separately. If you are worried about the video encoding, just try HTML5 Video Player which can convert your videos into different HTML5 video formats in a batch mode. Also since you may host your websites on different web server types, such as Windows server with IIS, or Linux server with Apache, HTML5 MIME types will need to be configured in different ways according to your server types.

HTML5 Video MIME Types Setup on Apache/Linux Servers

For example, if you are an Apache web server you can add the following code to your httpd.conf file or you can simply create a file called .htaccess file with the following text and upload it to your website root directory:

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

The first line is for videos in an Ogg container. The second line is for videos in an MPEG-4 container. The third is for WebM.

HTML5 Video MIME Types Setup on IIS/Windows Servers

If you are using an IIS server, you can configure it on your IIS server, or you can add the MIME–types in your Web.config.

To set up HTML5 video MIME types on IIS servers, you can open IIS Manager on the Windows server, then navigate to the MIME Types settings, there are some differences between the IIS versions. Review your web hosting and their documentation or consult your web developer on how to set the HTML5 video mime type for specific file types on Windows servers. If you are on Windows server 2003 with IIS 6, you can refer to this guide; for Windows server 2008 and IIS7, please click here.

Another 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. However please note this method will work on any IIS7 web server, and it will be ignored on all non-IIS7 web servers, so it should be safe to do no matter the type of application or content. Optionally, you can see this guide for more.

The following section needs to be added in your configuration file:

<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".ogv" mimeType="video/ogg" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
</staticContent>
</system.webServer>
</configuration>

If you use some other web server, consult your server’s documentation on how to set the HTML5 video mime type for specific file types.

Now you know what are the video MIME types on web servers and how to set up HTML5 MIME types, HTML5 video MIME types on Apache and IIS servers.

, ,

Comments are currently closed.

One Response to “HTML5 Video MIME Types Setup on Apache and IIS Servers”