Reputation: 5689
Im trying to embed a video on my facebook PAGE feed-wall with the below code. It uploads to facebook, but the thumbnail image is not showed and the video is not embeded. It displays a link, that opens the video in a new seperate window.
FB.api('/' + page_id, {fields: 'access_token'}, function(resp2) {
if(resp2.access_token) {
FB.api('/' + page_id + '/feed', 'post',{
message: headline +' \n'+ texten,
access_token: resp2.access_token,
picture: imgURL,
embed_html:"<object width=\"480\" height=\"360\" ><param name=\"allowfullscreen\" value=\"true\" /><param name=\"movie\" value=\"http://www.facebook.com/v/<%=facebookPageId%>\" /><embed src=\"http://www.facebook.com/v/<%=facebookPageId%>\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"480\" height=\"360\"></embed></object>" ,
width: 480,
height: 360,
source : videoURL,
name : headline,//rubriken brevid thumbnail bilden
link : videoURL//länken dit rubriken pekar, måste ha ett värde annars går länken till bilden på appmanagern!!!
//description : '<'%=facebookDescription%>'
}
I dont know what Im missing, any input appreciated, thanks!
I fixed it! See below.
Upvotes: 2
Views: 2761
Reputation: 5689
I tought that I would share how to upload and embed a video on a Facebook PAGE feed with the Facebook graph javascript api!
And I use the below code:
function postToPage2() {
var imgURL = 'http://www.mypage.com/images/image.jpg';
var videoURL = 'http://www.mypage.com/video/video.mp4';
var swfURL ='http://www.mypage.com/video/player.swf?file='+videoURL+'&autostart=true&controlbar=false';
var page_id = 'my facebook page id';
FB.api('/' + page_id, {fields: 'access_token'}, function(resp2) {
if(resp2.access_token) {
FB.api('/' + page_id + '/feed', 'post',{
message: headline +' \n'+ texten,
access_token: resp2.access_token,
picture: imgURL,
width: 400,
height: 300,
source : swfURL,
name : 'headline',
link : 'www.manmade.se',
description : 'some text'
}
This works the same if you upload to a ordinary facebook users aswell.
I hope you like it!
Upvotes: 3