视频上传至Facebook,与RestFB

问题描述 投票:0回答:4

我尝试上传视频与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"));

我做错了,可有人能帮助我吗?

java facebook api video restfb
4个回答
0
投票

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

新增支持通过https://graph-video.facebook.com新的视频上传API端点和固定一个多文件名错误,打破了视频上传。


0
投票

Facebook的入门指南视频上传可能是有用的https://developers.facebook.com/blog/post/493/


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 "));

-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"));

试试这个,它的工作100%

© www.soinside.com 2019 - 2024. All rights reserved.