【问题标题】:Facebook sharing video Graph APIFacebook 分享视频 Graph API
【发布时间】:2018-03-22 09:38:25
【问题描述】:

我正在尝试将视频网址从我的设备分享到 Facebook。为此,我使用以下代码:

GraphRequest request = null;
            try {
                request = GraphRequest.newPostRequest(
                        token,
                        "/me/videos",
                        new JSONObject("{\"file_url\":\"some url\",\"description\":\"Android upload\"}"),
                        new GraphRequest.Callback() {
                            @Override
                            public void onCompleted(GraphResponse response) {
                                // Insert your code here
                            }
                        });
            } catch (JSONException e) {
                e.printStackTrace();
            }

这是在Graph Explorer 生成的代码。但是,我收到一个错误:

{
"error": {
    "message": "There was a problem uploading your video file. Please try again.",
    "type": "OAuthException",
    "code": 390,
    "error_subcode": 1363030,
    "is_transient": true,
    "error_user_title": "Video Upload Time Out",
    "error_user_msg": "Your video upload timed out before it could be completed. This is probably because of a slow network connection or because the video you're trying to upload is too large. Please try again.",
    "fbtrace_id": "AxXLWPEDSIF"
}

}

Android Facebook SDK:4.28.0、4.31.0

【问题讨论】:

    标签: android facebook facebook-sdk-4.0 android-sharing


    【解决方案1】:

    原来参数应该直接在查询中发送。所以,工作代码:

        Bundle parameters = new Bundle();
        parameters.putString("file_url", uri);
        parameters.putString("description", comment);
        GraphRequest request = new GraphRequest(token, "me/videos", parameters, HttpMethod.POST, callback);
    

    决定发布这个,因为错误消息没有得到任何线索。

    【讨论】:

    • 当我使用“file_url”参数时收到此消息(应用程序无权执行此操作)。我们需要获取 pusblish 视频权限吗?
    猜你喜欢
    • 2013-08-30
    • 1970-01-01
    • 2011-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-18
    相关资源
    最近更新 更多