I’ve implemented the graph API POST /me/photos in my iOS app and its working fine. Same way I implemented the /me/videos with host graph-video.facebook.com suggested in Facebook documents and this link : [cURL - is there a way for upload a video to facebook without form? I get success response for this too like below but the video is not showing up on my Facebook account.
{
id = 10150481253673034;
url = "https://graph-video.facebook.com/me/videos";
}
Here is the code I have written :
NSString *str=[[NSBundle mainBundle] pathForResource:@"samplevideo" ofType:@"mov"];
NSData *imageFBData = [NSData dataWithContentsOfFile:str];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
imageFBData, @"source",
@"multipart/form-data", @"Content-Type",
message, @"message",
nil];
[FBRequestConnection startWithGraphPath:@"https://graph-video.facebook.com/me/videos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
// handle the result
NSLog(@"result : %@",result);
if(error)
NSLog(@"error : %@",error);
}];
if I use the URL as "/me/videos" like I use /me/photos instead of https://graph-video.facebook.com/me/videos, I get the below error:
{
body = {
error = {
code = 352;
message = "(#352) Sorry, the video file you selected is in a format that we don't support.";
type = OAuthException;
};
};
code = 400;
}
I tried with both .mp4 and .mov which are in supported videos. I'm sure there is no issue with video because the same video I upload to amazon S3 before posting to FB and I can play the uploaded video. Here is one sample: https://tagg-social-staging.s3.amazonaws.com/uploads/posts/videos/36/post-video.mp4 Note: I'm not posting the video using the above URL, but as multipart /form-data