Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rails app to upload and view videos?

Mike Cannon asked in General

I'm buidling a rails app that needs to be able to allow users to upload videos and view them in the app. Is the best strategy to use Youtube or would you recommend a different approach? Do you have any GoRails lessons on this topic or suggestions on any gems that might be out there for this purpose?i

Reply

Depends on what you need. I assume you want users to be able to upload videos through your application? What other features do you need?

If you don't mind the videos being publicly available, YouTube can work and it's probably your only free option.
We use Bunny.net for video hosting and it's very cheap compared to alternatives like Wistia, Mux, and AWS.

You could also use Rails' built-in ActiveStorage, but with video it helps to use a service that transcodes videos into playlists that can stream at different bitrates.

Bunny has some JavaScript you can use to upload videos from your application that you can read up on. You'll need to generate the signature server-side to keep your API key secret when generating the presigned uploads. This is basically the same way direct uploads work with ActiveStorage to send files directly from the browser to the hosting service instead of uploading to Rails, then uploading again to the hosting service.

Reply

Users need to be able to upload videos and these videos need to be able to be played inside the application. I'd prefer the the videos were not public, I was told that Youtube had the ability to create a private channel but may be miss informed. I created an app and used your blog tutorial as a guide and deployed the app to heroku. The app will currently allow a user to upload a video, stores the video on aws s3 through that rich text client which provides a file upload. I can see the video files on the index page but have not figured out how to play the videos in the app. Started thinking maybe I'm approaching this wrong and should just stored the videos on Youtube.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.