1

我上传视频的代码:

request = Request.newUploadVideoRequest(Session.getActiveSession(),  new File("/mnt/sdcard/DCIM/Camera/VID_20130317_185519.3gp"), FBRequestCallbacker);
Bundle params = request.getParameters();
if (!mPost.getDescription().equals("")) {
    params.putString("description",mPost.getDescription() + " \n\n" + footer.toString());
} else {
    params.putString("description", footer.toString());
}

if (!mPost.getDescription().equals("title")) {
    params.putString("title", mPost.getTitle());
}

request.setParameters(params);
request.executeAsync();

回调函数没有返回错误,即response.getError() == null。但是,Facebook 网站返回“无法处理您的视频。请访问视频帮助页面了解常见问题。” 并且没有办法进一步检查。

任何想法?非常感谢。

4

2 回答 2

2

试试这个代码,它正在工作:

File file=new File(Environment.getExternalStorageDirectory()+"/testvideo.mp4");
                        try {
                            Request audioRequest = Request.newUploadVideoRequest(session, file, new Request.Callback() {

                                @Override
                                public void onCompleted(Response response) {
                                    // TODO Auto-generated method stub

                                    if(response.getError()==null)
                                    {
                                        Toast.makeText(MainActivity.this, "Video Shared Successfully", Toast.LENGTH_SHORT).show();
                                    }
                                    else
                                    {
                                        Toast.makeText(MainActivity.this, response.getError().getErrorMessage(), Toast.LENGTH_SHORT).show();
                                    }
                                }
                            });
                            audioRequest.executeAsync();
                        } catch (Exception e) {
                            e.printStackTrace();

                        }
于 2013-08-08T12:03:47.327 回答
0

我终于弄清楚了以前的测试有什么问题。使用 Facebook SDK 可以将视频从 SD 卡上传到 Facebook 中的代码吗?完美运行。所有问题的罪魁祸首是我用于测试的FB帐户。我不确定我已经使用了几个月的测试帐户发生了什么。几个月前它工作得很好。通知消息只出现在我的测试帐户中,但从未出现在我的真实 FB 帐户中。我已成功将视频上传到我的真实 FB 帐户,没有任何问题。

但这并不能解释为什么测试帐户在测试中失败了。

于 2013-03-20T20:27:06.657 回答