Ruby 和 Webrick 视频流

发布于 2025-01-02 20:30:33 字数 636 浏览 3 评论 0原文

我正在开发一个网络应用程序,它将流式传输视频数据库,但我在使用 Webbrick 和 HTML5 视频时遇到困难。我正在使用一个简单的 HTML 标签,但视频似乎不会显示。有什么帮助吗? (顺便说一句,文件路径是正确的)。

这是我的 HTML 代码:

<div id="lr_video">

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

</div>

我的 Ruby 代码:

在 config/application.rb 中:

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

..
...

现在我使用 Webrick 作为生产服务器,并将我的视频放在“/public/assets/videos”下,但视频没有显示

任何内容帮助 ?

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).

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>

my Ruby code:

in config/application.rb:

...
..
    #HTML5 Video !!!
    config.assets.paths << "#{Rails.root}/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

any help ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不可一世的女人 2025-01-09 20:30:33

您发送的视频可能带有错误的 Content-Type 标头。

检查它的输出

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

应该说

Content-Type: video/mp4

如果没有,那么您应该修复内容类型标头的生成。

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

Check the output of

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

It should say

Content-Type: video/mp4

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文