2

I am trying to upload video on Facebook. But my code is not working:

FBRequest *m_UploadRequest = [[FBRequest requestWithSession: _session delegate: self] retain];
NSURL *videoUrl=[NSURL URLWithString:@"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"]; 
NSData* VideoFileData = [NSData dataWithContentsOfURL:videoUrl];
NSMutableDictionary* Parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"video.upload", @"method", @"Video Title", @"title", nil];
[m_UploadRequest call: @"facebook.video.upload" params:Parameters dataParam: VideoFileData];                          
Yi Jiang
  • 49,435
  • 16
  • 136
  • 136
Pankaj
  • 61
  • 8

1 Answers1

3

You can use the Facebook iOS SDK and should use the Graph API to upload a video:

NSURL *videoUrl=[NSURL URLWithString:@"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"];
NSData* VideoFileData = [NSData dataWithContentsOfURL:videoUrl];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
    VideoFileData, @"video.mov",
    @"video/mp4", @"contentType",
    @"Video Title", @"title",
    nil];                                                      
[facebook requestWithGraphPath:@"me/videos"
    andParams:params 
    andHttpMethod:@"POST"
    andDelegate:self];

You may have to wait little bit for the video to upload to your profile but you should see eventually see it there.

C Abernathy
  • 5,533
  • 1
  • 22
  • 27
  • Hi Christine, would you happen to have an answer to this question: http://stackoverflow.com/questions/14383600/play-facebook-video-in-uiwebview. You're the FB vid guru! – Orpheus Mercury Jan 17 '13 at 16:45