5

In my android app, the rquirement is to upload mp4 video files / JPEG images from SD card to facebook. We are able to post JPEG images to facebook. But when we try it for mp4 video file, it fails to upload. We are getting these errors

HTTP Error 400 Bad request

and error message

"error":{"message":"(#352) Sorry, the video file you selected is in a format that we don't support.","type":"OAuthException","code":352}}

Does it mean that uploading mp4 video files to facebook through Android is not possible at all ? Does facebook support uploading of mp4 files ?

Please help.

Ankit
  • 4,426
  • 7
  • 45
  • 62

2 Answers2

0

A similar question has already been answered in StackOverflow.

Is uploading videos from an SD Card to Facebook possible with the Facebook SDK?

Try this by Erick. The solution given there should work for you.

Community
  • 1
  • 1
niranjan94
  • 754
  • 1
  • 8
  • 28
0

I have faced your problem, and I changed the request params "video" -> "video.mp4" then it worked like a charm : ))

Here is my code

    File videoFile = new File(videoPath);
    AccessToken accessToken = AccessToken.getCurrentAccessToken();
    GraphRequest request = GraphRequest.newPostRequest(accessToken, "me/videos", null, new GraphRequest.Callback() {
        @Override
        public void onCompleted(GraphResponse response) {
            Log.d("mylog", "uploadVideo Completed " + response.toString());
        }
    });

    Bundle params = request.getParameters();
    params.putString("access_token", accessToken.getToken());
    params.putByteArray("video.mp4", getFileInByte(videoFile));
    request.setParameters(params);
    request.executeAsync();
John Le
  • 51
  • 6