#!/usr/bin/env ruby require 'animoto/client' include Animoto # Create a new client using our application key and secret client = Client.new("bb0d0e005ac4012dc17712313b013462", "c0fe4cfca8bf544b8d0e687247a600ef55ff82e3") client.endpoint = "https://platform-staging.animoto.com" custom_footage = Postroll::CustomFootage.new("http://s3-s.animoto.com/Footage/wInVzO78f0SjP1GTFtfPrA/t.mp4") #("http://api.client.java.animoto.s3.amazonaws.com/test_assets/footage.mp4") #custom_footage.start_time = 2.0 #custom_footage.duration = 5.0 # create a directing and rendering manifest with the video title and # producer. Also include rendering parameters like resolution, framerate, # and format. manifest = Manifests::DirectingAndRendering.new( :title => "Amazing Venus3!", :resolution => "360p", :style => "original", :pacing => "fast", :framerate => 24, :format => 'h264', :postroll => custom_footage ) # Add some images, text, and footage to our manifest. img1 = Assets::Image.new("http://cdn.toucharcade.com/wp-content/uploads/2012/12/hac1.jpg") #img1.cover = "Doctorine of pace" #img1.rotation = 2 #img1.spotlit = true #img1.caption = "Birds can't walk" img2 = Assets::Image.new("http://api.client.java.animoto.s3.amazonaws.com/test_assets/image.jpg") img3 = Assets::Image.new("http://blogs.independent.co.uk/wp-content/uploads/2012/12/some-girls-300x225.jpg") card1 = Assets::TitleCard.new("f1", "01234567890123456789") manifest << img1 manifest << card1 #manifest << img2 #manifest << img3 #manifest << card2 #manifest << card3 # Setup the soundtrack. manifest << Assets::Song.new("http://api.client.java.animoto.s3.amazonaws.com/test_assets/song.mp3", :artist => "Fishy Joe") dr_job = client.direct_and_render!(manifest) while dr_job.pending? sleep(1) puts "making it ready..." client.reload!(dr_job) end # Setup to get http callbacks for status notification (see below for # polling example). #manifest.http_callback_url = "http://mysite.com/animoto_callback" #manifest.http_callback_format = "json" # Send the manifest to the API. Your app will be notified of # completion/failure via an HTTP POST to # "http://mysite.com/animoto_callback" # client.direct_and_render!(manifest)