Created
October 21, 2010 19:17
-
-
Save jtushman/639114 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def enqueue_for_encoding | |
notifications = [] | |
notifications << "#{AppConfig.zencoder.callback_url.sub(/:id/,id.to_s)}" unless Rails.env == 'development' | |
#Make sure that urls match url in the has_attached_file method in video,thumbnail and encodings! | |
#TODO: Don't make the default security public | |
response = Zencoder::Job.create({ | |
:input => raw.url, | |
:output => {:label => "base", | |
:public => 1, | |
:url => "s3://#{AppConfig.s3.bucket}/videos/#{guid}/base/#{name_without_extension}.mp4", | |
:thumbnails => {:number => 6, | |
#:size => '160x120', | |
:base_url => "s3://#{AppConfig.s3.bucket}/videos/#{guid}/base/thumbnails", | |
:prefix => 'thumb' | |
}, | |
:notifications => notifications | |
}}) | |
if response.success? | |
self.update_attribute(:encoding_job_id,response.body['id']) #should be the job id | |
else | |
raise 'hmmm something happend with the encoding' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment