I have an mp4 video that I want to play in IE9 using HTML5 <video>
tag. I added the MIME type to IIS 7 so if I browse http://localhost/video.mp4
it plays in both Chrome and IE9 but not in HTML5, Chrome plays the video in HTML though. Here's the code:
<html>
<body>
<video src="video.mp4" width="400" height="300" preload controls>
</video>
</body>
</html>
Any ideas?
Thanks
UPDATE:
Tried the same file in Firefox 5.0 and it didn't work either, only Chrome is able to play the mp4 video.
I have a base profile .mp4 video which plays on one server, and does not on another.
The only difference is:
one gives a header
"Content-Length: ..."
the other
"Trasfer-Encoding: chunked".
I found out that Content-Length is not needed, it is only important, that there should be NO chunked header. This can be done by turning off compression (deflate or gzip) for .mp4 files. How this can be done is another issue and another topic: How to disable Apache gzip compression for some media files in .htaccess file?
There can be another server issue:
it has to give
"Content-Type: video/mp4"
and NOT
"Content-Type: text/plain"
If any of these answers above don't work, and you're on an apache server, adding the following to your .htaccess file:
I had a similar problem and adding this solved all my playback issues.
From what I've heard, video support is minimal at best.
From http://diveintohtml5.ep.io/video.html#what-works:
As well, you should note this section just below on the same page:
Try the following and see if it works:
Internet Explorer 9 support MPEG4 using H.264 codec. But it also required that the file can start to play as soon as it starts downloading.
Here are the very basic steps on how to make a MPEG file that works in IE9 (using avconv on Ubuntu). I spent many hours to figure that out, so I hope that it can help someone else.
Convert the video to MPEG4 using H.264 codec. You don't need anything fancy, just let avconv do the job for you:
This video will works on all browsers that support MPEG4, except IE9. To add support for IE9, you have to move the file info to the file header, so the browser can start playing it as soon as it starts to download it. THIS IS THE KEY FOR IE9!!!
qt-faststart
is a Quicktime utilities that also support H.264/ACC file format. It is part oflibav-tools
package.Dan has one of the best answers up there and I'd suggest you use html5test.com on your target browsers to see the video formats that are supported.
As stated above, no single format works and what I use is MP4 encoded to H.264, WebM, and a flash fallback. This let's me show video on the following:
Win 7 - IE9, Chrome, Firefox, Safari, Opera
Win XP - IE7, IE8, Chrome, Firefox, Safari, Opera
MacBook OS X - Chrome, Firefox, Safari, Opera
iPad 2, iPad 3
Linux - Android 2.3, Android 3
Note: The .mp4 video should be coded in h264 basic profile, so that it plays on all mobile devices.
Update: added autoplay="false" to the Flash fallback. This prevents the MP4 from starting to play right away when the page loads on IE8, it will start to play once the play button is pushed.