Skip to content

Instantly share code, notes, and snippets.

@veganstraightedge
Created March 25, 2010 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veganstraightedge/344197 to your computer and use it in GitHub Desktop.
Save veganstraightedge/344197 to your computer and use it in GitHub Desktop.
def flash_video_tag(css_id, file_url, size="640x480", options={})
if options[:autostart]
autostart = "true"
end
width, height = size.split("x")
player_url = "#{flash_video_host}players/player-licensed.swf"
player_args = "file=#{file_url}&autostart=#{autostart}"
player_url_and_args = "#{player_url}?#{player_args}"
file_type = "application/x-shockwave-flash"
params = []
params << tag(:param, :name => "movie", :value => player_url_and_args)
params << tag(:param, :name => "flashvars", :value => player_args)
params << tag(:param, :name => "allowfullscreen", :value => "true")
embed = tag(:embed,
:src => player_url,
:width => width,
:height => height,
:flashvars => player_args,
:allowfullscreen => "true",
:type => file_type,
:pluginspage => "http://get.adobe.com/flashplayer/"
)
content_tag(:object,
params.join + embed,
:classid => "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",
:id => css_id,
:width => width,
:height => height,
:type => file_type,
:codebase => "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0",
:data => player_url_and_args
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment