视频文件.ogv在Firefox本地播放,但不能从服务器播放 [英] Video file .ogv plays locally in Firefox, but not from server

查看:212
本文介绍了视频文件.ogv在Firefox本地播放,但不能从服务器播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Chrome,Safari或Opera中播放此视频时,我没有任何问题。当我尝试在Firefox中播放时,我得到一个没有视频的灰色框。这是我的代码:

 < video width =640height =360autobuffer controls preload =auto> ; 
< source src =fracWelDay3.mp4type ='video / mp4; codecs =avc1.42E01E,mp4a.40.2'>
< source src =fracWelDay3.webmtype ='video / webm; codecs =vp8,vorbis'>
< source src =fracWelDay3.ogvtype ='video / ogg; codecs =theora,vorbis'>
您的浏览器不支持视频标签。
< / video>

我也创建了一个.htaccess文件(见下文)并将它放在与我视频文件:

AddType音频/ ogg ogg
AddType视频/ ogg
AddType视频/ mp4 .mp4
AddType视频/ webm .webm

我的档案的连结是:

http://www.synergese.co.uk/testMathsOnline/day3/videos/day3FracWelVideo.html

我会很感激任何帮助。

非常感谢,
Philippa

解决方案

您的服务器的 fracWelDay3.ogv 视频的MIME类型未正确投放as'text / plain'。



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



请注意, Content-Type text / plain 而不是 vi deo / ogg

  HTTP / 1.1 200 OK 
日期: 2011 21:55:25 GMT
服务器:LiteSpeed
接受范围:字节
连接:关闭
ETag:fa8cc4-4dde175c-0
Last-Modified :周五,2011年05月26日09时03分24秒GMT
内容类型:文本/纯
内容长度:16420036

HTML5视频在Safari,Chrome和IE 9中播放,但不支持Firefox或IE 7-8。 如果您修复了 MIME类型问题,它将在Firefox中播放如果您使用的是Apache Web服务器或Apache的衍生产品,您可以使用 AddType指令

c $ c>在您的站点范围内 httpd.conf 或在 .htaccess文件中你的视频文件。 (如果您使用其他Web服务器,请参考您的服务器文档,了解如何为特定文件类型设置Content-Type HTTP标头。)

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

第一行是用于Ogg容器中的视频。第二行是用于MPEG-4容器中的视频。第三个是WebM。设置一次,忘记它。如果您忘记设置它,即使您在HTML标记的type属性中包含了MIME类型,您的视频也无法在某些浏览器中播放。


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

解决方案

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.

这篇关于视频文件.ogv在Firefox本地播放,但不能从服务器播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆