我正在尝试让Rails(3.0.0)在html5视频块中为iphone提供一个简单的m4v视频文件。为了理智,我正在使用来自http://camendesign.com/code/video_for_everybody的大降压兔子视频,我知道它已经正确编码为iPhone和工作
当我在Apache服务器上运行它时,它运行得很好。但是在我的rails dev环境中,它只是加载一个带有斜线的黑盒子。我的直觉告诉我它必须是某种类型的哑剧问题。
我已尝试将这些行添加到我的mime_types.rb文件中:
Mime::Type.register "video/mp4", :mp4
Mime::Type.register "video/mp4", :m4v
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"
})
但没有运气。有人建议将此行添加到mime_types文件中
MIME :: Type.add(MIME :: Type.from_array(“video / mp4”,%(m4v))
但是这导致了这个错误:
NameError: uninitialized constant MIME
from (irb):4
from /Users/theshaolinmonk/.rvm/gems/ruby-1.9.2-p0@rails3/gems/railties-3.0.0/lib/rails/commands/console.rb:44:in `start'
from /Users/theshaolinmonk/.rvm/gems/ruby-1.9.2-p0@rails3/gems/railties-3.0.0/lib/rails/commands/console.rb:8:in `start'
from /Users/theshaolinmonk/.rvm/gems/ruby-1.9.2-p0@rails3/gems/railties-3.0.0/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
有人有任何想法吗?
答案 0 :(得分:0)
也许将以下行添加到您的Gemfile中?
gem 'mime-types', :require => 'mime/types'