通过Graph API Javascript SDK上传Facebook视频 [英] Facebook video upload via Graph API Javascript SDK

查看:121
本文介绍了通过Graph API Javascript SDK上传Facebook视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Javascript SDK通过Graph API将视频上传到Facebook?

is it possible to upload a video to Facebook via the Graph API, using the Javascript SDK?

这样的事情......

something like this...

FB.api('/me/videos', 'post', {message: "Test", source: "@http://video.link.goes/here.flv", access_token: "token"}, function(response) {
   console.log(response)
}); 

现在我知道这不起作用,但有没有办法实现这样的使用Graph API和Javascript SDK?

now I know that this won't work, but is there a way to achieve something like this using the Graph API and Javascript SDK?

如果没有,使用旧的REST api上传视频片段会安全吗?..因为它将被弃用很快。

If not, would it be safe to use the old REST api to upload the video clip?.. since it is going to be deprecated soon.

提前Thanx!

推荐答案

是的,你可以这样将数据发布到iframe,如此处,或者您可以使用 jQuery文件上传
问题是你无法从iframe获得响应,使用插件可以使用页面句柄。
示例:

Yes, you can do this posting data to an iframe like here, or you can use jQuery File Upload . The problem is you can't get response from iframe, using plugin you can use a page handle. Example:

<form id="fileupload" action="https://graph-video.facebook.com/me/videos" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="access_token" value="user_access_token">
    <input type="text" name="title">
    <input type="text" name="description">
    <input type="file" name="file"> <!-- name must be file -->
</form>


<script type="text/javascript">

    $('#fileupload').fileupload({
        dataType: 'json',
        forceIframeTransport: true, //force use iframe or will no work
        autoUpload : true,
        //facebook book response will be send as param
        //you can use this page to save video (Graph Api) object on database
        redirect : 'http://pathToYourServer/videos?video=%s' 
    });
</script>

这篇关于通过Graph API Javascript SDK上传Facebook视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆