使用 RestFB 将视频上传到 Facebook
我正在尝试使用 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"));
我做错了什么,有人可以帮助我吗?
I'm trying to upload video with RestFB, I tried do this for 2 days, but still can't do it, can somebody help me with this?
What I've done.
I know that I can upload video with this method video.upload, and I must send request to the Facebook video server, so I create class VideoLegacyFacebookClient
, and put there this server, also I tried make new execute method, which take a InputStream binaryAttachement
for video, and try to make this code:
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"));
What did I do wrong, can someone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
RestFB 1.6.5 可能会修复这个问题; http://restfb.googlecode.com/svn/tags/restfb -project-1.6.5/CHANGELOG 说:
RestFB 1.6.5 may fix this problem; http://restfb.googlecode.com/svn/tags/restfb-project-1.6.5/CHANGELOG says:
关于视频上传的 Facebook How-tos 可能有用 https://developers.facebook.com/blog/帖子/493/
Facebook How-tos about video upload may be useful https://developers.facebook.com/blog/post/493/
下面的代码片段将使用有效的应用程序访问令牌、应用程序密钥,
注意:将视频保存在资源/视频文件夹下。
上传到页面:
Below Snippet will work with valid app access token, app secret,
Note: kept videos under resources/videos folder.
Uploading to a Page:
试试这个,100%有效
Try this one, it work 100%