我们的应用程序中有一个共享工具,我们可以方便地将图像/视频共享到Facebook。我们使用Facebook Android SDK 4.27.0进行Facebook登录和共享。
现在,图像/视频出现在我们自己的服务器上(,即我的设备上没有媒体),我们打算使用Graph调用直接与Facebook共享这些图像/视频。以下是照片共享的工作实现:
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();
但是,类似的视频实现无效:
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();
对于端点"https://graph-video.facebook.com/me/videos"
,我在与测试用户共享时收到以下响应:
{Response: responseCode: 200, graphObject: {"id":"10150481253673034","url":"https:\/\/graph-video.facebook.com\/me\/videos"}, error: null}
但是,视频没有显示在测试用户的时间线上。
对于端点"me/videos"
,我得到了回复,
{HttpStatus: 400, errorCode: 390, errorType: OAuthException, errorMessage: There was a problem uploading your video file. Please try again.}
那么,我该如何与Facebook分享视频?