Attach video from youtube to user's strem on Facebook using Open Graph and play it with Facebook's player
Hi I'm trying to attach a video from YouTube when publishing post on friend's wall. I'm using open graph plugin for Ruby on Rails https://github.com/jugend/fgraph but problem is rather related to params which I need to pass. Here's some code
fgraph_client.publish_feed(respondent.facebook_uid,
:name => "tezzzzzt",
:mess开发者_StackOverflow中文版age => "tezzzzzzzzzzzzzzzzzzzt",
:picture => "http://i.ytimg.com/vi/RNuUgbUzM8U/2.jpg",
:link => "http://www.youtube.com/watch?v=RNuUgbUzM8U"
)
So video and image is propely attached, but when I click a video it opens directly in youtube but I'd like to have it played in Facebook's movies player first.
Ok, I've only just now flicked through the rails fgraph docs, and the Facebook API docs, but it seems that the main mistake is that you aren't actually linking the video, you are linking the youtube page that has the video. I know it seems a bit odd, but theres a difference. Look at these two urls:
Page: http://www.youtube.com/watch?v=RNuUgbUzM8U
Video: http://www.youtube.com/v/RNuUgbUzM8U
The second one is very similar, but is actually a link to the swf that can be embedded in another page.
At a first guess, that might solve the problem, but I don't know how smart the API is. Otherwise you'll probably need to supply more information to the API.
thanks a lot! it saved me lots of time ! :) here's a correct set of attributes
fgraph_client.publish_feed(respondent.facebook_uid,
:name => "tezzzzzzzzzt",
:link => "http://www.youtube.com/watch?v=OQquLg8BwJY",
:message => "tezzzzzzzzzzzzzzzzzzz",
:picture => "http://i.ytimg.com/vi/RNuUgbUzM8U/2.jpg",
:source => "http://www.youtube.com/v/RNuUgbUzM8U"
)
精彩评论