Rails - 如何将 Webrick 中的(有效)文件加载到 HTML5 视频元素中?

发布于 2024-12-01 13:35:02 字数 1460 浏览 1 评论 0原文

此代码来自我桌面上的文件,不起作用:

<video src="http://0.0.0.0:3000/assets/attachable/108/original/501Spotlight_PSUB.mov" controls autobuffer="autobuffer" type="video/quicktime" height="300" width="400"></video>

以下是视频传输的网络事务:

http://project.touchstudios.net/public/broken.png

视频元素返回代码 4 - MEDIA_ERR_SRC_NOT_SUPPORTED

这确实有效:

<video src="501Spotlight_PSUB.mov" controls autobuffer="autobuffer" type="video/quicktime"height="300" width="400"></video> <!-- video file is on desktop too -->

这是其输出:

http://project.touchstudios.net/public/working.png

(请注意,待处理状态似乎永久显示)

我也摆弄过独角兽,并且遇到了类似的问题。也许我没有正确配置它。

asset/attachable 位于我的公共文件夹中。我的印象是 Rails 本身几乎(或不)参与传输/处理这些文件。

我已将此行添加到 config/initializers/mime_types.rb:

Mime::Type.register "video/quicktime", :mov

我从 Rails 控制台得到了以下输出:

>> Mime::Type.lookup_by_extension("mov")
=> #<Mime::Type:0x1020992e8 @string="video/quicktime", @synonyms=[], @symbol=:mov>
>> MIME::Types.type_for("asdf.mov").to_s
=> "video/quicktime"

WEBrick (1.3.1) 应该归咎于这里吗?这个确切的问题之前曾被问过,但没有解决。我希望能够提供更多细节。

有什么猜测吗?我可以回答任何有助于缩小范围的问题。

谢谢

This code, from a file on my desktop, does not work:

<video src="http://0.0.0.0:3000/assets/attachable/108/original/501Spotlight_PSUB.mov" controls autobuffer="autobuffer" type="video/quicktime" height="300" width="400"></video>

Here are the network transaction(s?) for the video transfer:

http://project.touchstudios.net/public/broken.png

The video element returns code 4 - MEDIA_ERR_SRC_NOT_SUPPORTED

This DOES work:

<video src="501Spotlight_PSUB.mov" controls autobuffer="autobuffer" type="video/quicktime"height="300" width="400"></video> <!-- video file is on desktop too -->

And here's the output for that:

http://project.touchstudios.net/public/working.png

(note that pending status seems to be displayed permanently)

I've fiddled around with Unicorn as well, and had similar problems. Maybe I didn't configure it properly.

assets/attachable is in my public folder. My impression is that rails itself is barely (or not) involved with transferring/processing those files.

I've added this line to config/initializers/mime_types.rb:

Mime::Type.register "video/quicktime", :mov

I have this output from rails console:

>> Mime::Type.lookup_by_extension("mov")
=> #<Mime::Type:0x1020992e8 @string="video/quicktime", @synonyms=[], @symbol=:mov>
>> MIME::Types.type_for("asdf.mov").to_s
=> "video/quicktime"

Is WEBrick (1.3.1) to blame here? This exact question was asked before, but not resolved. I'm hoping to be able to provide more detail.

Any guesses? I can answer any question that'll help narrow this down.

Thanks

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文