Youtube and rails, how to show video in player


#1

Hi,

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?

cheers
jon


#2

jon wrote:

See:
http://shanesbrain.net/articles/2006/11/21/ruby_youtube_library_0_8_0_released


#3

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.


#4

thanks job for sharing!

jon wrote:

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.

yeah, I discovered it can be done easily by using this code below


#5

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.

yeah, I discovered it can be done easily by using this code below


#6

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:

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
http://www.youtube.com/v/#{youtube_id}

HTH