您好我试图将视频上传到s3并使用流动播放器显示
我的流程图崩溃,因为数字是在视频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>
这会破坏我的流程图,但是在查看来源后点击链接会将我带到视频
<div class="flowplayer" style="width: 624px; height: 260px; ">
<video src="http://s3-ap-southeast-1.amazonaws.com/psyched-sg-store/624x260.mp4"></video>
</div>
这是有效的
我像这样设置我的回形针
# /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{^/},
"")}"
}
在我的模特中..
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
我也设置了我的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
怎么了?为什么数字出现在网址后面?
答案 0 :(得分:1)
这些数字是反缓存时间戳。如果您想摆脱它们,请将:use_timestamp => false
添加到模型的附件设置中,如:
has_attached_file :attached_video,:storage => :s3,
:s3_credentials => "#{Rails.root}/config/s3.yml",
:path => "/:filename",
:url => ":s3_sg_url",
:use_timestamp => false