youtube and rails, how to show video in player

jon wrote:


I have used the YouTube api to extracta set amount of video's, is anyone
aware of how I can show these in a player on my ruby on rails site?

are there any plugins that may help?



koloa wrote:

awesome post...but is there a way to just embed a particular youtube video with an id? i see only options for feature, user, get by tag, and friends of user.

Sure. You can either use video_details(video_id) to find all the details for the video (and also make it dead simple to display, or just use the code from
#embed_html -- all it does is wrap the id in html, like this:

<object width="#{width}" height="#{height}">
  <param name="movie" value="#{embed_url}"></param>
  <param name="wmode" value="transparent"></param>
  <embed src="#{embed_url}" type="application/x-shockwave-flash" wmode="transparent" width="#{width}" height="#{height}"></embed>

where width and height are passed to the embed_html method

and where embed_url is generated from the video's page on YouTube by

@embed_url = @url.delete('?').sub('=', '/')

So, you don't actually need to even use the gem if you know the id, and could generate the embedded video yourself using something like "{youtube_id}"