视频文件 .ogv 在 Firefox 中本地播放,但不能从服务器播放

发布于 2024-11-10 04:43:52 字数 976 浏览 7 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过度放纵 2024-11-17 04:43:52

您的服务器上的 fracWelDay3.ogv 视频的 MIME 类型错误地作为“text/plain”提供。

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

请注意,Content-Typetext/ plain 而不是 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

HTML5 视频可以在 Safari、Chrome 和 IE 9 中播放,但不能在 Firefox 或 IE 7-8 中播放。 如果您修复MIME类型问题,它将在 Firefox 中播放.

如果您使用的是 Apache Web 服务器或 Apache 的某些衍生产品,则可以在站点范围的 httpd.conf 或中使用 AddType 指令存储视频文件的目录中的 .htaccess 文件。 (如果您使用其他 Web 服务器,请查阅服务器的文档,了解如何为特定文件类型设置 Content-Type HTTP 标头。)

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

第一行适用于 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 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文