HTML 5视频(ogv)和MIME类型 [英] HTML 5 video (ogv) and MIME types

查看:764
本文介绍了HTML 5视频(ogv)和MIME类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法弄清楚以下问题:

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:

Rails:.m4v文件的MIME类型问题

Setting Mime Type for .ogv files in Rails Development Environment

让OGG视频与Rails一起使用

这些都没有帮助我,而且我完全陷入困境。

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类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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