5

在我的 android 应用程序中,要求是将 mp4 视频文件/JPEG 图像从 SD 卡上传到 facebook。我们能够将 JPEG 图像发布到 facebook。但是当我们尝试将它用于 mp4 视频文件时,它无法上传。我们收到这些错误

HTTP Error 400 Bad request

和错误信息

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

这是否意味着根本不可能通过 Android 将 mp4 视频文件上传到 facebook?facebook 是否支持上传 mp4 文件?

请帮忙。

4

2 回答 2

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.

于 2013-09-01T15:45:27.870 回答
0

我遇到了你的问题,我改变了请求参数“video”->“video.mp4”然后它就像一个魅力:))

这是我的代码

    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();
于 2017-06-25T03:22:22.733 回答