Home Unable to share a video to Facebook
Reply: 0

Unable to share a video to Facebook

pulp_fiction
1#
pulp_fiction Published in 2018-02-13 14:09:56Z

We have a sharing facility in our App where we facilitate sharing images/videos to Facebook. We are using Facebook Android SDK 4.27.0 for Facebook login and sharing.

Now, the images/videos are present on our own server(i.e, the media is not present on my device) and we intend to share these directly with Facebook using a Graph call. Here is the working implementation of photo sharing:

Bundle postParams = new Bundle();
postParams.putString("name", itemdesc);
postParams.putString("url", itemurl);

new GraphRequestAsyncTask(new GraphRequest(
    AccessToken.getCurrentAccessToken(), "me/photos", postParams, HttpMethod.POST,
    new GraphRequest.Callback() {
        @Override
        public void onCompleted(GraphResponse response) {
            FacebookRequestError error = response.getError();
            // Do something with the error
        }
    })).execute();

But, a similar implementation for videos is not working:

Bundle postParams = new Bundle();
postParams.putString("name", itemdesc);
postParams.putString("url", itemurl);

new GraphRequestAsyncTask(new GraphRequest(
    AccessToken.getCurrentAccessToken(), "https://graph-video.facebook.com/me/videos", postParams, HttpMethod.POST,
    new GraphRequest.Callback() {
        @Override
        public void onCompleted(GraphResponse response) {
            FacebookRequestError error = response.getError();

        }
    })).execute();

For the endpoint, "https://graph-video.facebook.com/me/videos", I get the following response on sharing with a test user:

{Response:  responseCode: 200, graphObject: {"id":"10150481253673034","url":"https:\/\/graph-video.facebook.com\/me\/videos"}, error: null}

But, the video doesn't show on the test user's timeline.

And for the endpoint, "me/videos", I get the response,

{HttpStatus: 400, errorCode: 390, errorType: OAuthException, errorMessage: There was a problem uploading your video file. Please try again.}

So, how do I go about sharing a video to Facebook?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.549732 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO