Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Finding out the destination YouTube URL when uploading videos to YouTube via youtube_it gem with Rails
- def create
- @video = Video.new(params[:video])
- if @video.save
- uploader = YouTubeIt::Upload::VideoUpload.new( :username => AppConfig[:youtube_user],
- :password => AppConfig[:youtube_pass],
- :dev_key => AppConfig[:youtube_api_key])
- uploader.upload open( params[:video][:attachment] ), :title => @video.title,
- :description => @video.description,
- :category => 'some category',
- :keywords => ['some keyword 1', "some keyword 2"]
- @video.deliver_video_notification
- flash[:notice] = 'Your video is under review for approval.<br/> Please check back in 48 hours.'
- redirect_to videos_url
- else
- @errors = @video.errors
- @current_video = params[:v].blank? ? Video.newest : Video.find(params[:v])
- render :action => :index
- end
- end
- def create
- @video = Video.new(params[:video])
- if @video.save
- uploader = YouTubeIt::Upload::VideoUpload.new( :username => AppConfig[:youtube_user],
- :password => AppConfig[:youtube_pass],
- :dev_key => AppConfig[:youtube_api_key])
- uploaded_video = uploader.upload open( params[:video][:attachment] ), :title => @video.title,
- :description => @video.description,
- :category => 'some category',
- :keywords => ['some keyword 1', "some keyword 2"]
- puts uploaded_video.player_url # This will print the URL to the log
- @video.deliver_video_notification
- flash[:notice] = 'Your video is under review for approval.<br/> Please check back in 48 hours.'
- redirect_to videos_url
- else
- @errors = @video.errors
- @current_video = params[:v].blank? ? Video.newest : Video.find(params[:v])
- render :action => :index
- end
- end
Add Comment
Please, Sign In to add comment