问题
is it possible to modify the follow standard code for posting a facebook feed thru ios to have a youtube clip instead of a picture? Just like one posts a youtube link on his/her wall through the browser where you can click and view the video without leaving the page. I would still like to keep a separate link that is not the youtube video link if possible though.
Tried searching but seems like not much questions asked on posting youtube video through the SDK... Thanks much in advance!
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"http://www.somedomain.com/pic.png", @"picture",
@"http://www.somedomain.com", @"link",
@"Post Name", @"name",
@"Post Caption", @"caption",
@"Message", @"description",
nil];
[facebook dialog:@"feed" andParams:params andDelegate:self]
回答1:
figured it out. add video link in "source" (note the format for the url that links directly to the swf). also found out the hard way (got an error in the dialog) that for a flash video, "picture" needs to be included as well, the url used here is the generic pic for youtube video.
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"__MY_APP_ID__", @"app_id",
@"http://google.com", @"link",
@"http://www.youtube.com/v/hpP7wvMqGYU", @"source",
@"http://img.youtube.com/vi/hpP7wvMqGYU/0.jpg", @"picture",
@"myName", @"name",
@"myCaption", @"caption",
@"myDescription", @"description",
nil];
[facebook dialog:@"feed" andParams:params andDelegate:self];
回答2:
I found this question here on SO. Is this what you're looking for?
NSString *video_link = @"http://www.youtube.com/v/#####";
NSString *image_link = @"http://i.ytimg.com/vi/#####/2.jpg";
NSDictionary *video_share = [NSDictionary dictionaryWithObjectsAndKeys:
@"flash", @"type",
video_link, @"swfsrc",
image_link, @"imgsrc",
@"100", @"width",
@"80", @"height",
@"400", @"expanded_width",
@"320", @"expanded_height",
nil];
video published with Facebook-SDK not playing in iPhone facebook app
来源:https://stackoverflow.com/questions/10933183/youtube-instead-of-pic-on-facebook-feed-thru-ios-sdk