问题描述
我无法弄清楚以下问题:
I can't figure out the following problem:
我在我的网站上使用HTML 5视频。对于crossbrowser支持,我将视频保持为mov和ogv格式,以便Firefox可以播放它。
I use HTML 5 video on my web site. For crossbrowser support, I keep video in "mov" and "ogv" formats, so that Firefox can play it.
在./config/initializers/mime_types.rb中具有以下代码:
In ./config/initializers/mime_types.rb I have the following code:
Rack::Mime::MIME_TYPES.merge!({
".ogg" => "application/ogg",
".ogx" => "application/ogg",
".ogv" => "video/ogg",
".oga" => "audio/ogg",
".mp4" => "video/mp4",
".m4v" => "video/mp4",
".mp3" => "audio/mpeg",
".m4a" => "audio/mpeg"
})
它适用于我的本地机器,但不适用于生产服务器。
It works on my local machine, but won't on a production server.
我尝试了很多方法这项工作:
I've tried many ways to make this work:
这些都没有帮助我,而且我完全陷入困境。
None of these helped me, and I'm completely stuck.
推荐答案
在生产服务器或机器上,如果您使用的是Nginx或Apache等Web服务器,则需要在其中声明这些mime类型服务器的相应配置文件以重新识别它。这已经完成了吗?
On the production server or machine, if you are using a web server such as Nginx or Apache you need to declare those mime types within the respective config files for the server to rexognise it. Has this been done?
这篇关于HTML 5视频(ogv)和MIME类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!