Nov 20, 2013

Internet Explorer demands an accurate Content Type

If you regularly use HTML5 video and S3 (or any other provider I suppose) to deliver the content, you have probably seen this message: "Error: Unsupported audio type or invalid file path". So you have your code like so:

<video preload="none" controls="controls">
 <source src="https://mysite.com/video.mp4" type="video/mp4">
</video>

Looks good? Works fine in all browsers except IE. Delve into the dev tools and you will see the content-type that the mp4 file is being delivered under is "application/octet-streaming", which IE doesn't like. Hosting files on your own server usually wont bring up this kind of problem since the content-type will default to that of the file extension. S3, however, requires you explicitly set it yourself. For some reason. 

So if you go into your AWS Console, select the file, then its properties and expand the Metadata section, you should see a dropdown list where you can type in your content-type, "video/mp4".

Tags: internet explorer, metadata, html5 video

No Comments

Add a Comment