Class: Onebox::Engine::YoutubeOnebox
- Inherits:
-
Object
- Object
- Onebox::Engine::YoutubeOnebox
- Includes:
- Onebox::Engine, StandardEmbed
- Defined in:
- lib/onebox/engine/youtube_onebox.rb
Constant Summary
Constants included from Onebox::Engine
Instance Attribute Summary
Attributes included from Onebox::Engine
Instance Method Summary collapse
Methods included from StandardEmbed
add_oembed_provider, add_opengraph_provider, #always_https?, oembed_providers, opengraph_providers, #raw
Methods included from Onebox::Engine
engines, included, #initialize, #options, #options=
Instance Method Details
#placeholder_html ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/onebox/engine/youtube_onebox.rb', line 13 def placeholder_html if video_id "<img src='https://i.ytimg.com/vi/#{video_id}/hqdefault.jpg' width='#{WIDTH}' height='#{HEIGHT}' #{Helpers.title_attr()}>" elsif list_id "<img src='#{list_thumbnail_url}' width='#{WIDTH}' height='#{HEIGHT}' #{Helpers.title_attr()}>" else to_html end end |
#to_html ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/onebox/engine/youtube_onebox.rb', line 23 def to_html if video_id <<-HTML <iframe width="#{WIDTH}" height="#{HEIGHT}" src="https://www.youtube.com/embed/#{video_id}?#{}" frameborder="0" allowfullscreen> </iframe> HTML elsif list_id <<-HTML <iframe width="#{WIDTH}" height="#{HEIGHT}" src="https://www.youtube.com/embed/videoseries?list=#{list_id}&wmode=transparent&rel=0&autohide=1&showinfo=1&enablejsapi=1" frameborder="0" allowfullscreen> </iframe> HTML else # for channel pages html = Onebox::Engine::WhitelistedGenericOnebox.new(@url, @cache, @timeout).to_html return if Onebox::Helpers.blank?(html) html.gsub!(/['"]\/\//, "https://") html end end |