我已将 .mp4 视频转换为 .ogg 和 .webm 格式(使用 ffmpeg),并使用 videojs 创建以下网页,该网页可在所有浏览器(IE6-IE9、safari、chrome、opera、firefox)上播放视频):
http://tanguay.info/examples/testvideo
但是,Firefox (12.0) 并不总是播放音频,具体取决于页面的访问方式:
从 file:// 播放,使用 ogg 之前的 webm 源,Firefox 播放良好:
<source src="videos/damconnect.mp4" type='video/mp4'>
<source src="videos/damconnect.webm" type='video/webm'>
<source src="videos/damconnect.ogg" type='video/ogg'>
但是在 webm 之前从 file:// 和 ogg 源播放时,Firefox 会无音频播放:
首先使用 ogg 或 webm 从 http:// 播放,Firefox 会无音频播放。
如何让 Firefox 通过 http://播放音频?
附录:
另外:如果首先列出 ogg,Opera 将不会播放视频(只是旋转,不启动)。
我注意到我的 tanguay.info 服务器似乎正在发送带有 .webm 视频的文本/纯文本 header ,我该如何更改它?
答案:
我将此 .htaccess 文件添加到了 index.htm 所在的目录中,这解决了问题:
AddType audio/ogg oga ogg
AddType video/ogg ogv
AddType video/webm webm
最佳答案
对于 text/plain
- 编辑 mime.types
文件 (~www/conf
) 并添加 webm/video网络管理
您可能在使用 ogg/ogv
时遇到同样的问题,请添加 mime 类型 ogg/video ogg ogv
还要确保转换时音频编解码器正确。
编辑
Ok, I see you added it to the httpd.conf
- just read this
10.5.31. TypesConfig TypesConfig names the file which sets the default list of MIME type mappings (file name extensions to content types). The default TypesConfig file is /etc/mime.types. Instead of editing /etc/mime.types, the recommended way to add MIME type mappings is to use the AddType directive.
For more information about AddType, refer to Section 10.5.54 AddType.
虽然我可以找到任何论据来解释为什么......
关于html - 为什么 videojs HTML5 视频在 Firefox 中无法播放声音?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10834621/