1

I have the following in a .html file:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Testing</title>
</head>
<body>
    <video id="0" controls width="502" height="479">
        <source src="vid1.webm" type='video/webm'>
        <source src="vid1.mp4" type='video/mp4'>
        <p>Video is not visible, most likely your browser does not support HTML5 video</p>
    </video>
</body>
</html>

When I open the html file in IE9 I see the video and I can play it, no problem.

Now, I have the same html inside a web page that runs in a site hosted on my local IIS 7.5. When I view the webpage no video is shown at all, the page is blank. I've added the following to the web.config file:

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

When I view the MIME types in the website setting in IIS, all of the above are listed, so it's picked them up no problem.

I'm stuck now as I can;t see why IE9 won't play the video. Both FireFox and Chrome display the video without any hassle, so why (yet again) does IE have to be the odd one out? :)

Could someone help me out please?

Edit: In response to Bart's comment, here is the profiler output when I requested the page:

http://localhost/Rest/test.html GET 304 text/html  161 B    < 1
/Rest/vid1.mp4  GET 200 video/mp4   32.24 KB    125 ms
/Rest/vid1.mp4  GET 206 video/mp4   80.91 KB    15 ms
/Rest/vid1.mp4  GET 200 video/mp4   144.20 KB   1.04 s

Edit:

I checked the format of the MP4. Basically I used Freemake to convert an AVI file into a MP4, using the default preset "Same a source : H.264, AAC original size". So as far I'm aware, the MP4 file is H.264 format.

AS I mentioned, IE9 will display the file when opening the HTML file, but when running under IIS, it doesn't like it.

Edit I followed the instructions given in this post : http://blogs.msdn.com/b/thebeebs/archive/2011/07/20/html5-video-not-working-in-ie9-some-tips-to-debug.aspx to dump out any error codes from the video element. Here is what I got:

MEDIA_ERR_DECODE 3

People tend to reflect this as

An error of some description occurred while decoding the media resource, after the resource was established to be usable.

Does anyone know what I'm supposed to do in response to this?

Jason Evans
  • 28,906
  • 14
  • 90
  • 154
  • Did you check the mime type in the browser? – Split Your Infinity Jul 12 '12 at 13:53
  • See http://stackoverflow.com/questions/6944679/html5-mp4-video-does-not-play-in-ie9 – Split Your Infinity Jul 12 '12 at 13:59
  • I had the problem like this on Safari, when the server hadn't appropriate mimetype for such files. But for example Chrome plays it because it understands the mimtype from coming stream and don't rely on mimtype sent by server. Don't rely on the profiler's output, it will be better to check it on server's configuration by hand – haynar Jul 12 '12 at 14:02
  • It is not the video format, because you mentioned that it worked outside of IIS. I know IE9 is pain in the @ss when it comes to mime types. – Split Your Infinity Jul 12 '12 at 14:06
  • Did you access the videos on the server at any point before you configured the MIME types? Have you cleared cache and hard refreshed? – robertc Jul 12 '12 at 14:28
  • @robertc Tried that just now, but no joy. – Jason Evans Jul 12 '12 at 14:39

1 Answers1

1

You probably do not have the mime type setup in IIS. You have to manually set the file types up before IIS will serve content like videos, pdf, etc. It is a security best practice thing.

Chris Love
  • 3,740
  • 1
  • 19
  • 16
  • Thanks for the response. Unfortunately, I've since left the project that the above question was related to. However, I now have something else I can check if this type of issue crops up again. Thanks :) – Jason Evans Nov 05 '13 at 08:25
  • I have the Mime type setup, but Chrome won't seek ahead properly. Seems I need a HTTP 206 header, but don't know how to force it. – PeterX Jul 06 '15 at 07:13