视频文件 .ogv 在 Firefox 中本地播放,但不能从服务器播放
我在 Chrome、Safari 或 Opera 中播放该视频没有任何问题。当我尝试在 Firefox 中播放它时,出现一个没有视频的灰色框。这是我的代码:
<video width="640" height="360" autobuffer controls preload="auto" >
<source src="fracWelDay3.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
<source src="fracWelDay3.webm" type='video/webm; codecs="vp8, vorbis"'>
<source src="fracWelDay3.ogv" type='video/ogg; codecs="theora, vorbis"'>
Your browser does not support the video tag.
</video>
我还创建了一个 .htaccess 文件(见下文)并将其放在与我的视频文件相同的文件夹中:
AddType audio/ogg oga ogg 添加类型视频/ogg ogv 添加类型 视频/mp4 .mp4 AddType video/webm .webm
我的文件的链接是:
http:// www.synergese.co.uk/testMathsOnline/day3/videos/day3FracWelVideo.html
如果有任何帮助,我将非常感激。
非常感谢, 菲利帕
I'm not having any problems playing this video in Chrome, Safari or Opera. When I try to play it in Firefox, I get a grey box with no video. Here is my code:
<video width="640" height="360" autobuffer controls preload="auto" >
<source src="fracWelDay3.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
<source src="fracWelDay3.webm" type='video/webm; codecs="vp8, vorbis"'>
<source src="fracWelDay3.ogv" type='video/ogg; codecs="theora, vorbis"'>
Your browser does not support the video tag.
</video>
I have also created an .htaccess file (see below) and put it in the same folder as my video files:
AddType audio/ogg oga ogg
AddType video/ogg ogv
AddType video/mp4 .mp4
AddType video/webm .webm
The link to my file is:
http://www.synergese.co.uk/testMathsOnline/day3/videos/day3FracWelVideo.html
I would be very grateful for any help.
Many thanks,
Philippa
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的服务器上的
fracWelDay3.ogv
视频的 MIME 类型错误地作为“text/plain”提供。$ curl -I http://www.synergese.co.uk/testMathsOnline/day3/videos/fracWelDay3.ogv
请注意,Content-Type 是
text/ plain
而不是video/ogg
:HTML5 视频可以在 Safari、Chrome 和 IE 9 中播放,但不能在 Firefox 或 IE 7-8 中播放。 如果您修复MIME类型问题,它将在 Firefox 中播放.
如果您使用的是 Apache Web 服务器或 Apache 的某些衍生产品,则可以在站点范围的
httpd.conf
或中使用AddType 指令
存储视频文件的目录中的.htaccess 文件
。 (如果您使用其他 Web 服务器,请查阅服务器的文档,了解如何为特定文件类型设置 Content-Type HTTP 标头。)第一行适用于 Ogg 容器中的视频。第二行用于 MPEG-4 容器中的视频。第三个是WebM。设置一次后就可以忘记它。如果您忘记设置它,即使您在 HTML 标记的 type 属性中包含了 MIME 类型,您的视频也将无法在某些浏览器中播放。
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 ofvideo/ogg
: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-widehttpd.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.)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.