BugTheLady
BugTheLady

Reputation: 35

Facebook: Embed YT video in post from php-sdk

I'm trying to post on user's wall with embed video. I have created app, i can post with picture, i can change messages,description, however there is a problem to embed video, YT video (which has proper OG meta), with my post. I have spent last day trying different combinations and i stuck

   $facebook new Facebook($properData);
   $params = array(
    'message' => 'Some text message',
        'link' => 'http://www.youtube.com/watch?v=kx89UV3cxk4', //the video to embed
        'name' => 'Some name',
        'caption' => 'Some caption',
        'picture' => 'http://img.youtube.com/vi/2raioEC7Hms/default.jpg',
        'source' => 'http://www.youtube.com/watch?v=2raioEC7Hms', //the video to embed
        'description' => 'Some desc',
    'type' => 'video',
        'actions' => array(
            'name' => 'My app ',
            'link' => 'http://apps.facebookcom/mydummyapp'),
        'privacy' => array('value' => 'EVERYONE'));

    $post = $facebook->api('/me/feed', 'post', $params);

Upvotes: 1

Views: 1734

Answers (1)

mitchellhislop
mitchellhislop

Reputation: 445

You need to extract the URL of the actual video to pass it for source, not the YT page

It appears that you can generate a valid source and picture from the page URL. The URL looks like http://www.youtube.com/watch?v=; take the code (2raioEC7Hms here) and insert it into the URLs http://www.youtube.com/e/ for the source. In this case, http://www.youtube.com/e/2raioEC7Hms

Upvotes: 2

Related Questions