使用Facebook C#SDK在墙上发布Mp3附件
本文关键字:Mp3 附件 Facebook C#SDK 使用 | 更新日期: 2023-09-27 18:26:09
im试图用mp3附件发布到facebook的墙上,并执行以下操作:
var attachment = new JsonObject();
attachment.Add("message");
attachment.Add("name", "Core4");
attachment.Add("href", "www.google.com");
attachment.Add("description", description);
var media = new JsonObject();
media.Add("type", "mp3");
media.Add("src", "http://www.somesite.com/Ride.mp3");
media.Add("href", "http://www.google.com");
var mediaArray = new JsonArray();
mediaArray.Add(media);
attachment.Add("media", mediaArray);
var result = _fbClient.Post("/me/feed", attachment);
帖子发布了,但mp3播放器没有显示!我什么都试过了,有人知道为什么会发生这种事吗?
这很有效。。。。
var attachment = new JsonObject();
var media = new[]{
new{
type="mp3",
src = filePath,
title= "title",
artist= "art",
album= "album"
}
};
//var mediaArray = new JsonArray { media };
attachment.Add("name", "sfs");
attachment.Add("href", "http://www.google.com");
attachment.Add("caption", " asdas");
attachment.Add("description", description);
attachment.Add("target_id", "1231231");
attachment.Add("media", media);
var sb = new StringBuilder("https://api.facebook.com/method/stream.publish?");
sb.Append("message="); sb.Append(description + "&");
sb.Append("attachment=");
sb.Append(attachment);
sb.Append("&access_token=");
sb.Append(accessToken);
var req = WebRequest.Create(sb.ToString());
req.GetResponse();