Uploading Videos to Facebook via the Javascript SDK Graphics API

Is it possible to upload videos to Facebook via the Graph API using the Javascript SDK?

something like that...

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

      

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

If not, would it be safe to use the old REST api to load the video clip? .. as it will soon be deprecated.

Thanx in advance!

+1


source to share


2 answers


Yes, you can make this data send to an iframe like here , or you can use jQuery File Upload . The problem is that you cannot get the response from the iframe using the plugin, you can use the page descriptor. 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>

      

+1


source


The question is very similar to the one asked here: Facebook new javascript sdk - upload photos with it! ...



0


source







All Articles