Skip to content

Instantly share code, notes, and snippets.

@julesfern
Created February 2, 2009 14:01
Show Gist options
  • Select an option

  • Save julesfern/56919 to your computer and use it in GitHub Desktop.

Select an option

Save julesfern/56919 to your computer and use it in GitHub Desktop.
def embed_player_for(object, options={})
fallback_label = "Watch #{h object.name} on #{h @context.name}"
fallback_url, js_url = if object.is_a? VideoConstruct
[ @context.canonical_host+url_for_video_construct(object),
@context.canonical_host+url_for_video_construct(object, {:from=>"embed", :format=>"js"})]
else
[ @context.canonical_host+url_for_channel(object),
@context.canonical_host+url_for_channel(object, {:from=>"embed", :format=>"js")]
end
return "<script src=\"#{@context.canonical_host}#{js_url}\"></script>"+
"<br />Watch #{link_to(h(object.name), fallback_url)} on #{h @context.name}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment