Setup Paperclip plugin with Amazon S3 to upload videos in rails

This is taken from Clayton Lengel-Zigich. Thanks.

Create a video model.rb

Configure the config/s3.yml file

Configure and install right_aws gem

Then run: sudo rake gems:install & sudo rake gems:unpack

Create a videos controller with the prospective views for the uploading

Configure flash player to display video

1. Download JW FLV MEDIA PLAYER (mediaplayer.zip download link)
2. Copy and paste the player.swf file at public/flash/player.swf
3. Copy and paste the swfobject.js at public/javascript/swfobject.js
4. Configure your application.html.erb file to call swfobject.js in the head

That’s it, you should now be able to upload flv video files and view them in a flash player by going to http://localhost:3000/videos. For instructions on converting quicktimes videos to flash videos on file upload take a look at Jim Neath’s tutorial on converting videos with rails.

Development vs Production mode

It’s a good idea to create a bucket for development and a bucket for production. If you decide to, you can do the following.
Note:this assumes you started your app with bort, and already have a settings.yml that gets loaded by the load_config.rb file using APP_CONFIG = YAML.load_file(“#{RAILS_ROOT}/config/settings.yml”)[RAILS_ENV].symbolize_keys)

In config/settings.yml

In video.rb

Picture of Scott Motte

delicious facebook rss twitter

Spitfire Sky | github | archives | resume