How to allow users to embed YouTube & Vimeo videos? - ruby-on-rails

How can I go about allowing users to embed YouTube and Vimeo videos in my Rails app?
I'd provide a text field or text area where users can add the link of the video they wish to embed.
Click add and have my app show a spinner while the details are being gathered.
When the details are found, I'd want them displayed on the page before user can finally submit the post.
I'm guessing the HTML, link details will need to be stored in the database so the video can automatically be displayed every time the page is visited.
HTML5 has a file API that gives me the ability to display users local file data on the fly. Wondering if there is something similar for display remote data or would normal ajax be used?
Is there a standard way of doing this? Also are there any tutorials out there on how to do this in rails? Would like to go about doing this in the most safest and securest way.
I love tutorials and screencasts so I'd really be thankful for info on where I can find one to achieve what I'm trying to achieve.

Try to use open graph protocol to fetch site information before user sending the form.
I suggest the following gem:
https://github.com/intridea/opengraph
Open graph protocol:
http://ogp.me/
And I guess you should store all the fetched information in database.

The Video Thumb gem is probably what you are looking for.
It handles vimeo, youtube and potentially others.
Then you just do:
<%= VideoPlayer::player(library_item.url, 700, 420).html_safe %>
In your view to display an automatically generated embed code.

Related

Adding multiple youtube playlists to site just like youtube has em

this is desired output for site
this is how youtube displays multiple playlist...how can I add this just like they have it to my site AND to linkedin profile?
embedding the share html link just brings in playlist but it does not display properly....I need it to appear exactly like it does in attached pic???
Linking to your LinkedIn profile, I have not tried. So perhaps someone else can tell you.
As to having a section like the one you showed to be on your own site is doable.
Firstly you will need to collect the playlist ID's that you are going to use.
Then you will need to get the video ID's from the video's in each Playlist.
This can be done with the API.
As to the displaying it like on youtube, you will need to do that yourself with one or more combination of table's, div's and CSS. Then With the information you grabbed in the APi, populate it.
Best to do it in a loop so as to be done all at the same time. Then put it to the page where you require it to be.

SurveyMonkey. Creating my own front-end

Can I create a SurveyMonkey survey, then build the survey's front-end on our intranet, but have the form post to the SurveyMonkey? This will allow me to use their result page and reports, while allowing me to design the page using internal video clips to vote on our intranet for a small user base of 225 users.
There is no ability to post data with the Survey Monkey API. So far, you can only get data: link.
One option may be to use embed which allows you to embed a survey into your website: link.
To add to the answer by philshem, you can embed videos from your intranet in your survey. As long as respondents have access to the video source, you should be able to get exactly what you're looking for. The link on SurveyMonkey's docs site about embedding media is http://help.surveymonkey.com/articles/en_US/kb/How-do-I-add-a-video-or-sound-clip-to-my-survey
The short answer is that you need to have HTML enabled for the survey and use an iFrame to embed the content.

How to read the first few lines of a website

I am trying to implement a feature to your web application, in which if a user saves a website's url, it is stored and displayed in the library. Now when a web url is saved in facebook, the first few lines of the webpage is also displayed. I also want to implement a similar feature.
I am using Ruby on Rails. I tried using the .load() method of jquery, but using that I am only able to retrieve description of pages which are in the application. I want to save a url in my app, eg, "api.jquery.com/load/";, and while displaying the list of urls, I want to display a description of the page, like its shown in facebook when you enter a url in the status update
Any suggestions on how to do it?

search for and embed youtube videos in ruby on rails application

I have a website where I want to basically allow people to display several youtube videos onto the same page.
For example, I have a friend who has 3 different videos. Instead of sending a link to the three videos individually, they would go to my site see the 3 search boxes, search for the videos individually (the search is done on youtube), then they can pick the videos and click "done", at which point, the 3 videos would be embedded on their page.
I'm trying to figure out how to approach this in ruby on rails, but I'm not finding much information on how.
Here's a link from 2009 of a guy who's saying that he can actually do the search and retrieve from youtube: http://railsforum.com/viewtopic.php?id=30443
But I don't know how to do the search & retrieve, and I don't know how to do the embed. I think I can figure out the embed, but what's the best way to do the search/display results?
Thanks a lot for your help stackoverflow, you're my only hope (besides google, but google failed me today).
all you need to know about the search feature is described in YouTube Data Api. You will need your app to communicate with this API. The best thing to do may be to look after a gem specialized in this ; there is a list available in another StackOverflow question.

User Video Embedding in Rails 3

I am building an app using Rails 3 that allows users to submit videos. I would like to be able to accept simply the video URL from the user and using this, my app will generate the appropriate embed code (depending on the video source). Is there a good library for something like this that already exists? I'd rather not have to reinvent the wheel here and write my own regex/scripts to embed the videos if something already exists.
Think of how tumblr works...you just paste in the url of the video and it embeds it all automatically.
Thanks!
I would look into the embedly api it may be able to address your problem.

Resources