[LRUG] Rails: using send_file to send video to the browser
javier ramirez
javier.ramirez.gomara at gmail.com
Wed Aug 5 06:33:35 PDT 2015
Hi,
I'm assuming you are using X-SendFile to send the file?
If so, you should be able to install the h264 module on Nginx/Apache and
the web server should take care of the pseudo streaming
Also, this kind of streaming works better when the file is properly
encoded[2]
Cheers,
j
[1] http://h264.code-shop.com/trac/wiki
[2] https://sixohthree.com/streaming-mp4-with-nginx
On 05/08/15 14:12, Tom Armitage wrote:
> I'm working on a project that displays HTML5 video in the browser, and
> access to those videos is controlled.
>
> Previously, I was using an expiring S3 URL; now I'm hosting the video
> myself, attached via Paperclip. The uploads directory is outside the
> /public directory of the Rails app; there's a URL for the video that,
> when a user hits it, checks if they're authorised to view it, and if
> so, uses send_file to send it to them.
>
> This no longer works very well now that I'm using send_file - I
> /think/ this comes down to the fact the browser requests video with
> Range headers, getting it in chunks, and my poor back-end clearly
> isn't doing something sophisticiated enough.
>
> My initial thoughts were:
>
> * something like
> [http://stackoverflow.com/questions/6759426/rails-media-file-stream-accept-byte-range-request-through-send-data-or-send-file],
> which odes the chunking manually but is beginning to make me feel
> stupid, and also feels fragile
> * is Puma the issue, and would a better web server for development work?
>
> I'm asking because whilst I think I've found the right track, some of
> you might have had experience of this before.
>
> t.
>
> --
> Tom Armitage
> http://infovore.org
> 07813 060578
>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
--
javier ramírez
javier ramirez's home page (http://javier-ramirez.com)
<http://javier-ramirez.com>
javier ramirez's blog (http://formatinternet.com)
<http://formatinternet.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20150805/6f171476/attachment-0003.html>
More information about the Chat
mailing list