Ruby和Webrick视频流 [英] Ruby and Webrick Video Streaming

查看:121
本文介绍了Ruby和Webrick视频流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个网络应用程序,它将流式传输视频数据库,但我在使用Webbrick和HTML5视频方面遇到了困难。我使用的是简单的HTML标签,但视频似乎无法显示。任何帮助? (文件路径是正确的btw)。

I am developing a web-app that will stream a database of videos, but I am having difficulties with Webbrick and HTML5 Video. I am using a simple HTML tag but the video won't seem to show up. any help ? (the file path is correct btw).

这是我的HTML代码:

Here is my HTML Code:

<div id="lr_video">

<%= video_tag (["videos/final_video.mp4", "final_video.ogg", "movie.webm"], :size => "320x240", :controls => true, :autobuffer => true) %>

</div>

我的Ruby代码:

in config /application.rb:

in config/application.rb:

...
..
    #HTML5 Video !!!
    config.assets.paths << "#{Rails.root}/public/assets/videos"

..
...

现在我使用Webrick作为制作服务器,我将视频放在/ public / assets / videos下,但视频没有显示

now I am using Webrick as a production server, and I put my videos under "/public/assets/videos" but the video doesn't show up

任何帮助?

推荐答案

您可能正在使用错误的Content-Type标头发送视频。

You are probably sending the video with the wrong Content-Type header.

检查输出

curl -I http://localhost:3000/assets/final_video.mp4 | grep Content-Type

应该说

Content-Type: video/mp4

如果不是,那么你应该修复内容类型标题的生成。

If if does not, then you should fix the generation of the content-type header.

这篇关于Ruby和Webrick视频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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