Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Website Video doesn't work

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>
like image 542
Alexyuiop Avatar asked Mar 13 '26 05:03

Alexyuiop


1 Answers

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
like image 124
Tom Sarduy Avatar answered Mar 15 '26 05:03

Tom Sarduy