当您有意在 FB 上分享 YouTube 链接时,它会自动将 YouTube 播放器嵌入到您的墙中,看起来像这样
但是...当我尝试使用FB sdk发布相同的视频时,HelloFacebookSampleActivity => postStatusUpdate()
mathood。
public void postStatusUpdate() {
if (user != null && hasPublishPermission()) {
final String message ;
message = ( user.getFirstName()+" "+ getString( R.string.status_update_link)+ " " +video_id + " " + getString(R.string.google_play_link));
Request request = Request
.newStatusUpdateRequest(Session.getActiveSession(), message, new Request.Callback() {
@Override
public void onCompleted(Response response) {
showPublishResult(message, response.getGraphObject(), response.getError());
}
});
request.executeAsync();
} else {
pendingAction = PendingAction.POST_STATUS_UPDATE;
}
}
它看起来像这样
所以我发现这个链接是为了将链接格式从更改http://www.youtube.com/watch?v=<code>
为 http://www.youtube.com/e/<code>
或添加&autoplay=1
到<code>
但它不起作用......我用谷歌搜索了“facebook android Embedded link youtube”,但没有找到关于这个问题的任何信息,需要帮助
如何使用 Facebook sdk 发布嵌入式 YouTube 链接(如图片 1)?
更新 :
我转换了我的代码,现在我正在使用Publish to Feed代码。但问题没有解决
我尝试通过 facebook mansion 之类的来源发布,但它不起作用......
postParams.putString("name", "Facebook SDK for Android");
postParams.putString("caption", "Build great social apps and get more installs.");
postParams.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
postParams.putString("source","http://www.youtube.com/e/2raioEC7Hms");