Video file .ogv plays locally in Firefox, but not from server

荒凉一梦 提交于 2019-11-29 21:48:27
rjb

The MIME-type from your server for the fracWelDay3.ogv video is incorrectly being served as `text/plain'.

$ curl -I http://www.synergese.co.uk/testMathsOnline/day3/videos/fracWelDay3.ogv

Notice that Content-Type is text/plain instead of video/ogg:

HTTP/1.1 200 OK
Date: Thu, 26 May 2011 21:55:25 GMT
Server: LiteSpeed
Accept-Ranges: bytes
Connection: close
ETag: "fa8cc4-4dde175c-0"
Last-Modified: Thu, 26 May 2011 09:03:24 GMT
Content-Type: text/plain
Content-Length: 16420036

The HTML5 video plays for me in Safari, Chrome and IE 9 but not Firefox or IE 7-8. If you fix the MIME-type issue, it will play in Firefox.

If you’re using the Apache web server or some derivative of Apache, you can use an AddType directive in your site-wide httpd.conf or in an .htaccess file in the directory where you store your video files. (If you use some other web server, consult your server’s documentation on how to set the Content-Type HTTP header for specific file types.)

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

The first line is for videos in an Ogg container. The second line is for videos in an MPEG-4 container. The third is for WebM. Set it once and forget it. If you forget to set it, your videos will fail to play in some browsers, even though you included the MIME type in the type attribute in your HTML markup.

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