Rails - 如何将 Webrick 中的(有效)文件加载到 HTML5 视频元素中?
此代码来自我桌面上的文件,不起作用:
<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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论