Why does an embedded ogg video work on localhost, but not on the web server?

十年热恋 提交于 2019-12-12 19:17:49

问题


I have an ogg video which works just fine using the video tag when I run it on localhost in either Chrome or Firefox. However, when I try running the page on the server, the video player controls show up, but not the video.

I know the video is up on the server, because I have a download link that works which has the same exact path.. I'm at a loss.

<video width="800" controls preload>
   <source src="../VIDEOS/AddUser.ogg" type="video/ogg" />
   <object width="800" type="video/ogg" data="../VIDEOS/AddUser.ogg">
     <object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" id="player" width="800" height="550"><param name="url" value="../VIDEOS/AddUser.wmv" /><param name="src" value="../VIDEOS/AddUser.wmv" /><param name="showcontrols" value="true" /><param name="autostart" value="true" />
        There was an error embedding the video. Please download the video to view.<br>
     </object>
   </object>
</video>

After fiddling around with it for a while, I've discovered that, according to the browser, the video simply isn't there. when I check the server, the file is up. However, when I navigate directly to the file within the browser, I get a file not found error.

Could this be an issue with my web host, or is there some other possible cause?


回答1:


It's likely that your host needs to add the OGG MIME type to the server.

The MIME type details can be found on http://xiph.org The set up instructions will differ depending on whether the server is Apache or IIS




回答2:


Expanding the @mradbourne answer: 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.

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



回答3:


Don't forget Webm type file on yout .htaccess if you have one :)

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




回答4:


I saw there is an OGG and a WMV video. Which of them are correct? Maybe you need to upload both the files. If that doesn't work, check if the problem is the relative path: ../ trying to pass the absolute path http://.../ instead.



来源:https://stackoverflow.com/questions/3910698/why-does-an-embedded-ogg-video-work-on-localhost-but-not-on-the-web-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!