3

I am making a website with a video that is in .ogg and .mp4 , but for some reason when i go on my website in chrome, it doesn't play when it is hosted by hostmonster. The video works fine on the localhost, so I don't know why it isn't working.

Here is my code if it helps:

<video width="100%" height="100%" >

 <source src="web.ogg" type="video/ogg" autoplay="autoplay">
  <source src="web.mp4" type="video/mp4" autoplay="autoplay">

 Your browser does not support the video tag.
</video>
Alexyuiop
  • 813
  • 2
  • 10
  • 25
  • Can you please try and see what happens if you enter one of the video URLs directly in the browser. It should begin to play them. You could also press F12 on your webpage, switch to the Network tab and then press F5. There should then appear some info about what Chrome fetches, and what is returned from your host. – Martin Risell Lilja Nov 20 '12 at 07:47
  • when I open the video in a new tab, it tells me the file cannot be found, and I had imported the video files into the public html folder on hostmonster many times already. When i play the video file locally it works fine though. – Alexyuiop Nov 20 '12 at 07:50
  • 2
    please refer to http://stackoverflow.com/questions/3910698/why-does-an-embedded-ogg-video-work-on-localhost-but-not-on-the-web-server – Sasi Dhar Nov 20 '12 at 07:53

1 Answers1

3

Your code is ok, it should work on every browser that support HTML5 Video, the problem is that your server is not responding to mime-type such .ogg or .mp4. By default, Apache decides what media type to send with each file by inspecting the file's extension. The extension-type mappings are stored in the mime.types file in the httpd/conf directory. If a pair extension-type is missed then you have that problem. That's the reason why it works on localhost, but is not working on your server, differents mime.types files

If you have access to the mime.types file search this lines:

video/mp4                   mp4 mp4v mpg4
video/ogg                   ogv

If you cannot modify your master configuration files, edit the .htaccess file located in your root directory (if not exist, feel free to create it). Add this lines:

AddType video/mp4 mp4 mp4v mpg4
AddType video/ogg ogv
Tomas Ramirez Sarduy
  • 17,294
  • 8
  • 69
  • 85