Class: HostedVideo::Providers::Youtube

Inherits:
Base
  • Object
show all
Defined in:
lib/hosted_video/providers/youtube.rb

Direct Known Subclasses

YoutubeByIframe

Instance Attribute Summary

Attributes inherited from Base

#url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#iframe_code, #initialize, #kind, #vid

Constructor Details

This class inherits a constructor from HostedVideo::Providers::Base

Class Method Details

.can_parse?(url) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/hosted_video/providers/youtube.rb', line 5

def self.can_parse?(url)
  url =~ /(youtube\.com\/watch\?v=)|(youtu\.be\/)/
end

Instance Method Details

#previewObject



9
10
11
# File 'lib/hosted_video/providers/youtube.rb', line 9

def preview
  "http://img.youtube.com/vi/#{vid}/hqdefault.jpg"
end

#url_for_iframeObject



13
14
15
# File 'lib/hosted_video/providers/youtube.rb', line 13

def url_for_iframe
  "http://www.youtube.com/embed/#{vid}?wmode=transparent"
end