I am new to using youtube-g gem and i would like to embed a youtube video rapper that plays videos on my rails app hosted from youtube. pls does anyone know a youtube-g tutorial or another gem with a simpler readme and documentation that can help. So also a quick tutorial help as an answer would be great
Share
The ‘youtube-g’ gem was actually replaced by the ‘youtube_it’ gem located here: https://github.com/kylejginavan/youtube_it
If all you want to do is a regular embed of a youtube video, you can just use this wrapper (HAML syntax):
If you want to dynamically pull videos from your youTube channel you need to create a client and pull the stream like so:
That will give you a VideoSearch Object. If you wanted to iterate through all of those video objects:
That will return an array of Video objects where you have access to all of these attributes listed here: http://rubydoc.info/gems/youtube_it/1.4.1/YouTubeIt/Model/Video
This includes the YouTube url. If you wanted to use the player and and url on your page, you can just do some regEx to extract the video_id and build it yourself. Hope this helps.