Thursday, January 30, 2014

Web Server Video Support

I was playing with HTML 5 video and encountered the following error in Firefox "no video with supported format and MIME type found" and  that in Internet Explorer "Error: Unsupported video type or invalid file path". The HTML file looks like the following,


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>HTML 5 Video Example</title>
</head>
<body>
<h1>Chapter 1: HTML/XHTML</h1>
<h2>Video Example</h2>
<video width="600" height="500"
       autoplay="autoplay"
       controls="controls"
       preload="auto"
       poster="novideo.png">
  <source src="./ex.mp4" type="video/mp4" />
  <source src="./ex.ogv" type="video/ogg" />
  <source src="./ex.webm" type="video/webm" />
  Your browser does not support the video element
</video>
</body>
</html>

The video clip of all 3 formats are at the server and the video plays well at the local machine and fine at another server. After a little bit digging, I found out that the Apache web server has some configuration issue and did not have proper MIME types added. To fix it, simply upload a .htaccess file to the directory where the HTML file is and the .htaccess has the following content,


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

No comments:

Post a Comment