【发布时间】:2013-05-03 06:29:09
【问题描述】:
我们无法使用默认的 rails 3 应用程序提供可在 ipad 上播放的 mp4。在桌面上的 chrome 和其他浏览器中查看路线时,mp4 会正确提供。
这是我们的代码:
file_path = File.join(Rails.root, 'test.mp4')
send_file(file_path, :disposition => "inline", :type => "video/mp4")
我们点击 0.0.0.0:3000/video/test.mp4 来观看视频并在 ipad 上显示无法播放图标。我们已经尝试修改各种标题“Content-Length”、“Content-Range”等,但它们似乎不会影响最终结果。
我们也在一定程度上尝试过使用 send_data
即
File.open(file_path, "r") do |f|
send_data f.read, :type => "video/mp4"
end
在 Ipad 上观看时,可以从公共文件夹中正常播放相同的视频。
通过 rails 将 mp4 文件传送到 Ipad 的正确方法是什么?
【问题讨论】:
标签: ruby-on-rails ipad mp4