any one know how to share video on facebook from website.
please help out.
this is my code.
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:url': overrideLink,
'og:title': overrideTitle,
'og:description': overrideDescription,
'og:video': overrideImage,
'og:video:secure_url': overrideImage,
'og:video:type': "video/mp4",
'og:video:width': 600,
'og:video:height': 350
}
})
});
Related
Is it possible to add option for share location somewhere in the code using share_open_graph?
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object: {
'og:url': url,
'og:title': title,
'og:description': description,
'og:image': thumb
}
})
});
I just realized that when we using facebook api to create a livestream ( /me/live_videos ) , we only get 360p as output max even we sent 1080p. But, if we use Facebook dialog, we can get to 720p, the same video input.
FB.ui({
display: 'popup',
method: 'live_broadcast',
phase: 'create',
}, function(response) {
FB.ui({
display: 'popup',
method: 'live_broadcast',
phase: 'publish',
broadcast_data: response
}, function(response) {
});
});
https://developers.facebook.com/docs/graph-api/reference/live-video/
Does anyone know how to get 720p when we use Facebook graph API ?
I am trying to share image from FB app, using send dialog like I am doing for past few years.
var obj = {
method: 'feed',
link: 'https://www.facebook.com/pages/TESTPAGE?sk=app_XXXXXXXXXXXXXX&app_data=share|10',
caption: '',
name: 'Title for share',
description: 'description fort share',
picture: IMG_URL
};
I have provide 2 screenshots
when I click on share button inside of app
what I keep getting on my profile wall.
Until few months ago, FB would show data from feed method, but now, feed is acting just like share method: it shares url, without image and labels I sent through feed dialog.
All I want is to share image from app, and url of that image should point to app url.
Any suggestions?
I came across this issue from yesterday. The issue only happens when you pass in the FB app link url to the Link option. The works fine with the images as long as the link url is not anything related to FB.
So the workaround I found was to get a shortened URL from google and passed it instead of the normal app link.
FB.ui({
name: 'temp',
method: 'feed',
picture: '',
link: '{shortened url}',
caption: 'temp',
description: 'temp',
redirect_uri: 'any url'
}, function(response){
});
You can try this code to share image from FB app:
FB.ui(
{
method: 'feed',
display: 'popup', // must be one of "popup", "dialog", "iframe", "touch", "async", "hidden", or "none"
name: 'Title for share',
description: 'Description for share',
caption: 'www.facebook.com/YourFbPage/app_xxxxxxxxxxxxxxxxxxx',
link: 'http://PathToYourDomain.com/Folder/',
picture: 'http://PathToYourDomain.com/Folder/img/img-1200x627.jpg',
},function(response) {
if (response && response.post_id) {
// alert('Post was published.');
} else {
// alert('Post was not published.');
}
}
);
Best and good luck!
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object : {
'og:url': str_href,
'og:title': 'title', //galleryItem.title,
'og:description': 'desc', //galleryItem.description,
'og:og:image:width': '2560',
'og:image:height': '960',
'og:image': str_picture //BASE_URL + '/images/works/galleries'
}
})
});
I made a small app to FB that is using FB.ui to allow users to share it on their wall. I'd like the shared posts to show "Share" link next to "Comment" and "Like", like on any normal wall post.
Is there any way to do this with FB.ui?
Or is there some other method that would still allow me to define customized image, title, description etc. to the wall post?
My current code:
function share(name, description) {
FB.ui({
method: 'feed',
name: name,
picture: '/img/fb.png',
link: url,
caption: '',
message: '',
description: description
}, function() {
});
}
it can be done with share_open_graph method. the code should look like this
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object : {
'og:url': 'http://astahdziq.in/', // your url to share
'og:title': 'Here my custom title',
'og:description': 'here custom description',
'og:image': 'http://example.com/link/to/your/image.jpg'
}
})
},
// callback
function(response) {
if (response && !response.error_message) {
// then get post content
alert('successfully posted. Status id : '+response.post_id);
} else {
alert('Something went error.');
}
});
For the share action,
FB.ui({
method: 'share',
href: 'https://developers.facebook.com/docs/',
}, function(response){});
To define customized image, title, description, use Open Graph Tags in the head of your page:
<meta property="og:url" content="http://samples.ogp.me/136756249803614" />
<meta property="og:title" content="Chocolate Pecan Pie" />
<meta property="og:description" content="This pie is delicious!" />
<meta property="og:image" content="https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/851565_496755187057665_544240989_n.jpg" />
The effect would be:
You have to use the action property
see the documentation here
I'm using FB.ui to post to a Facebook user wall. However, I am uncertain on which parameters to use to post to a Page or Application wall. Any links?
I am trying to post to the Page wall as that page, not as the user's account.
Code to post to user account:
FB.ui(
{
method: 'feed',
name: name,
link: link,
picture: picture,
caption: caption,
description: redemption,
message: message
},
function (response) {
if (response && response.post_id) {
alert(response.post_id);
} else {
}
}
);
Got it:
you have to set the to and from values:
FB.ui( {
method: 'feed',
name: name,
link: link,
picture: picture,
caption: caption,
description: redemption,
message: message,
to: page_id,
from: page_id
},
function (response) {
if (response && response.post_id) {
alert(response.post_id);
} else {
}
}
);
I used the JavaScript SDK to post on user's wall:
function graphStreamPublish(){
var body = document.getElementById("txtTextToPublish").value;
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
}
When I go through the Graph API Page I think if you change '/me/feed/' to 'pageId/feed' then it may post the message in that page. I am not sure. - just a suggestion.
To share on a friend's wall, as of February 2012:
FB.ui({
method: 'stream.publish',
app_id: appId,
display: 'iframe',
name: name,
link: link,
picture: picture,
caption: caption,
description: description,
target_id: friendIds
});
To post to facebook wall use the following.. .
Call the below js function using simple call as in below
Post to Wall image/text?
//facebook: post to wall
function publishWallPost() {
FB.ui({
method: 'feed',
name: 'Your App Name',
caption: 'Caption Text',
description: 'Your description text',
link: 'https://www.facebook.com/link/link.link',
picture: fbImg
},
function (response) {
console.log('publishStory response: ', response);
});
return false;
}
window.fbAsyncInit = function () {
FB.init({
appId: 'Your App ID',
status: true,
cookie: true,
xfbml: true
});
};
(function () {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
Sorry, this is an old question, but I thought this might be helpful for people who find it via google.
http://fbmhell.com/2011/07/facebook-share-popup-iframe-tabs-jquery/
Just remember target_id needs to be parsed into an int. The response["to"] comes back as a string.