lib/onebox/engine/vimeo_onebox.rb in onebox-1.8.85 vs lib/onebox/engine/vimeo_onebox.rb in onebox-1.8.86
- old
+ new
@@ -5,16 +5,35 @@
include StandardEmbed
matches_regexp(/^https?:\/\/(www\.)?vimeo\.com\/\d+(\/[^\/]+)?$/)
always_https
+ WIDTH ||= 640
+ HEIGHT ||= 360
+
def placeholder_html
- oembed = get_oembed
- "<img src='#{oembed.thumbnail_url}' width='#{oembed.thumbnail_width}' height='#{oembed.thumbnail_height}' #{oembed.title_attr}>"
+ image_src = og_data.image_secure_url || og_data.image_url
+ "<img src='#{image_src}' width='#{WIDTH}' height='#{HEIGHT}' #{og_data.title_attr}>"
end
def to_html
- get_oembed.html
+ video_src = og_data.video_secure_url || og_data.video_url
+ video_src = video_src.gsub('autoplay=1', '').chomp("?")
+ <<-HTML
+ <iframe width="#{WIDTH}"
+ height="#{HEIGHT}"
+ src="#{video_src}"
+ data-original-href="#{link}"
+ frameborder="0"
+ allowfullscreen>
+ </iframe>
+ HTML
+ end
+
+ private
+
+ def og_data
+ @og_data = get_opengraph
end
end
end
end