0

我正在尝试使用 RestFB 上传视频,我尝试了 2 天,但仍然无法做到,有人可以帮助我吗?我做了什么。

我知道我可以用这个方法video.upload上传视频,而且我必须向 Facebook 视频服务器发送请求,所以我创建了类VideoLegacyFacebookClient,并把这个服务器放在那里,我也尝试了新的执行方法,它需要一个InputStream binaryAttachement视频,并尝试制作此代码:

InputStream is=new DataInputStream(new FileInputStream(new File("/home/hagen/testing.avi")));
postId = facebookClient.execute("video.upload", null, String.class,is,
                    Parameter.with("title", "My Test Video"),
                    Parameter.with("description", "This is description"));

我做错了什么,有人可以帮助我吗?

4

4 回答 4

0

关于视频上传的 Facebook How-tos 可能很有用https://developers.facebook.com/blog/post/493/

于 2011-09-05T18:36:16.147 回答
0

RestFB 1.6.5 可能会解决这个问题;http://restfb.googlecode.com/svn/tags/restfb-project-1.6.5/CHANGELOG说:

通过https://graph-video.facebook.com添加了对新视频上传 API 端点的支持, 并修复了破坏视频上传的多部分文件名错误。

于 2011-09-05T15:34:46.997 回答
0

下面的代码片段将使用有效的应用访问令牌、应用密码、

注意:将视频保存在资源/视频文件夹下。

上传到页面:

DefaultFacebookClient facebookClient = new DefaultFacebookClient(accessToken, appSecret, Version.LATEST);
facebookClient.publish(fbPageID + "/videos", GraphResponse.class, BinaryAttachment.with("videoName.mp4", IOUtils.toByteArray(getClass().getResourceAsStream("/video/videoName.mp4"))),
                    Parameter.with("description", " Video Description "));
于 2019-02-03T17:28:13.367 回答
-1
DataInputStream is =new DataInputStream(
new FileInputStream(new File("C:\\Users\\samiii\\Desktop\\rock.mp4")));
                fbClient.publish("me/videos", FacebookType.class,
                BinaryAttachment.with("rock.mp4", is),
                Parameter.with("title", "rock"),
                Parameter.with("description", "my first vid"));

试试这个,百分百有效

于 2015-04-15T18:40:06.477 回答