admin管理员组文章数量:1384278
I'm using FB.ui method to post image to facebook as described below:
FB.ui({
display: 'popup',
method: 'feed',
name: 'image',
link: 'link',
picture: 'image path',
caption: 'caption',
description: 'description'
}, function(response){
// do something
});
I'm able to post image successfully, but couldn't post video. I have tried, but failed.
FB.ui({
display: 'popup',
method: 'feed',
link: 'link',
picture: 'thumbnail image path',
source: '.mp4',
caption: 'caption',
description: 'description'
}, function(response){
// do something
});
above approach is posting feed, I'm looking video should play on facebook only instead of taking link of page.
I am not sure whether I'm missing something on video post OR approach it self wrong.
Could someone help on video, I would really appreciate.
Thanks
I'm using FB.ui method to post image to facebook as described below:
FB.ui({
display: 'popup',
method: 'feed',
name: 'image',
link: 'link',
picture: 'image path',
caption: 'caption',
description: 'description'
}, function(response){
// do something
});
I'm able to post image successfully, but couldn't post video. I have tried, but failed.
FB.ui({
display: 'popup',
method: 'feed',
link: 'link',
picture: 'thumbnail image path',
source: 'https://example./media/video.mp4',
caption: 'caption',
description: 'description'
}, function(response){
// do something
});
above approach is posting feed, I'm looking video should play on facebook only instead of taking link of page.
I am not sure whether I'm missing something on video post OR approach it self wrong.
Could someone help on video, I would really appreciate.
Thanks
Share Improve this question asked May 11, 2015 at 4:40 Shivakumar PShivakumar P 1131 silver badge7 bronze badges1 Answer
Reset to default 6You can upload videos to Facebook, using the Graph API, in multiple ways. You can have resumable and non-resumable uploads.
The latter is the easiest; you post to graph-video.facebook. and the video data must be multipart/form-data
encoded. The files are limited to 1GB in size and 20 minutes long.
You can upload videos using the SDKs. For example, the following code will use the JS SDK:
/* make the API call */
FB.api(
"/{user-id}/videos",
"POST",
{
"source": "{video-data}"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Here the source
parameter is your encoded video file. See the docs for more info. Alternatively, if the video is already uploaded somewhere, you can use the file_url
parameter to provide a link to that video.
Please note: the JS SDK default to graph.facebook., but you need to post to graph-video.facebook.. So either you need to override the domain, or re-create the post with a normal JS http request. In that case, use the source
parameter and add your access_token
in a parameter with that name.
If you have more control over your video files and the process, you can upload the files in chunks. That will allow you to recover from lost upload segments, without the need to re-upload the whole file.
本文标签: How to upload video on facebook using FBui Javascript sdkStack Overflow
版权声明:本文标题:How to upload video on facebook using FB.ui Javascript sdk - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744534993a2611258.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论