【发布时间】:2012-10-08 18:04:20
【问题描述】:
您好,我正在尝试将视频上传到 s3 并使用 flowplayer 显示它
我的 flowplayer 崩溃了,因为数字是添加在视频 src 的 url 后面的
<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>
这会破坏我的 flowplayer ,但是在查看源代码后单击链接会将我带到视频
<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
怎么了?为什么url后面会出现数字?
【问题讨论】:
标签: ruby-on-rails amazon-s3 paperclip