Reputation: 1812
Hi im trying to upload a video to s3 and display it using flowplayer
my flowplayer crashes because the numbers are added at the back of the url of video src
<div class="flowplayer" style="width: 624px; height: 260px; ">
<video src="http://s3-ap-southeast-1.amazonaws.com/psyched-sg-store/624x260.mp4?1350552718"></video>
</div>
this breaks my flowplayer , but clicking on the link after view source brings me to the video
<div class="flowplayer" style="width: 624px; height: 260px; ">
<video src="http://s3-ap-southeast-1.amazonaws.com/psyched-sg-store/624x260.mp4"></video>
</div>
this works
i set up my paperclip like this
# /config/initializer/s3.rb
# if you're using sg buckets
Paperclip.interpolates(:s3_sg_url) { |attachment, style|
"#{attachment.s3_protocol}//s3-ap-southeast-1.amazonaws.com/#{attachment.bucket_name}/#{attachment.path(style).gsub(%r{^/},
"")}"
}
in my model..
has_attached_file :attached_video,:storage => :s3,
:s3_credentials => "#{Rails.root}/config/s3.yml",
:path => "/:filename",
:url => ":s3_sg_url"
def attached_video_url
if attached_video.file?
attached_video.url
else
nil
end
end
i also set up my s3.yml
development:
bucket: psyched-sg-store
access_key_id: xx
secret_access_key: xx
test:
bucket: psyched-sg-store
access_key_id: xx
secret_access_key: x
production:
bucket: psyched-sg-store
access_key_id: xx
secret_access_key: xx
whats wrong? why are the numbers appearing behind the url?
Upvotes: 0
Views: 945
Reputation: 9226
Those numbers are anti-caching timestamps. If you want to get rid of them, add :use_timestamp => false
to your model's attachment setup, as in:
has_attached_file :attached_video,:storage => :s3,
:s3_credentials => "#{Rails.root}/config/s3.yml",
:path => "/:filename",
:url => ":s3_sg_url",
:use_timestamp => false
Upvotes: 1