开发者

Strange situation with html5 video in rails3 project

I'm trying to implement html5 video in rails3 project and I stuck in strange situation. To show HTML5 videos on the user's page i added this code:

<!-- Video element -->
<video width="420" height="240" controls preload="metadata" poster="/images/video.jpg">
 <!-- Video sources -->
 <source src="/movies/video.ogv" type='video/ogg; codecs="theora, vorbis"'&开发者_如何学编程gt;
</video>

First weird thing is that the browser has added to original requests "GET /users/1" the request like this "GET /users/null", but it should be "GET /users/1" because the current user has id=1. Then in the movie controller (show action) i added this code:

filename = Rails.root.join('public/videos/' + params[:id] + '.' + params[:format])
send_file filename, :type => 'video/ogg'

where params[:id] is the name of video file. Everything seems alright, but i've got error:

ERROR Errno::ENOBUFS: An operation on a socket could not be performed 
because the system lacked sufficient buffer space or because a queue was full

Could you help me how to understand and resolve this thing? Thanks


Can'e make sense of your first problem. For #2, try this:

send_file filename, :type => 'video/ogg', :disposition => 'inline'


Webrick doesn't support video streaming as far as I can tell. Try switching to passenger

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜