Safari 和 Firefox 中的 HTML5 视频(mp4 和 ogv)问题 - 但 Chrome 一切正常 [英] HTML5 video (mp4 and ogv) problems in Safari and Firefox - but Chrome is all good

查看:26
本文介绍了Safari 和 Firefox 中的 HTML5 视频(mp4 和 ogv)问题 - 但 Chrome 一切正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

<video width="640" height="360" controls id="video-player" poster="/movies/poster.png">
 <source src="/movies/640x360.m4v" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
 <source src="/movies/640x360.ogv" type='video/ogg; codecs="theora, vorbis"'> 
</video>

  • 我正在使用 Rails(开发中使用 Mongrel,生产中使用 Mongrel+Apache).
  • Chrome(Mac 和 Win)可以在本地或从我的生产服务器播放任一文件(由一个然后另一个源标签测试).
  • Safari(Mac 和 Win)可以在本地正常播放 mp4 文件,但不能从生产环境中播放.
  • Firefox 3.6 不会在任一操作系统中播放视频.我只是在视频播放器区域中间看到一个灰色十字.
  • 我已确保 Mongrel 和 Apache 在每种情况下都设置了正确的 MIME 类型.
  • 从 Chrome 的结果中,我知道我的视频文件或文件被要求或交付的方式没有任何本质上的问题.
  • 对于 Firefox,我查看了 https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox它指的是错误"事件和错误"属性.似乎 'error' 事件被很好地直接抛出,当时没有错误属性.有谁知道如何诊断问题?

    For Firefox I looked at https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox where it refers to an 'error' event and an 'error' attribute. It seems the 'error' event is thrown pretty well straightaway and at that time there is no error attribute. Does anyone know how to diagnose the problem?

    推荐答案

    .ogg 的 HTTP 内容类型应该是 application/ogg(.ogv 的 video/ogg),而 .mp4 应该是 video/mp4.您可以使用网络嗅探器进行检查.

    The HTTP Content-Type for .ogg should be application/ogg (video/ogg for .ogv) and for .mp4 it should be video/mp4. You can check using the Web Sniffer.

    这篇关于Safari 和 Firefox 中的 HTML5 视频(mp4 和 ogv)问题 - 但 Chrome 一切正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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