Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook graph API : audio share

Can I share audio using facebook graphic API

  • Can I directly upload audio on facebook server like video?
  • Can I share audio link on facebook and it will show embedded player on facebook?

I have tried this solution ios Facebook Graph API - post Audio file , but it doesn't work as expected

What I tried is to share audio link http://bit.ly/Ok4ZX6 but show it on facebook like a normal link not with embedded player http://i.stack.imgur.com/Ld67c.png

Edit

Code I have use :

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:4];
[params setObject:text forKey:@"message"];
[params setObject:title forKey:@"name"];
[params setObject:fileUrl forKey:@"source"];
[facebook requestWithGraphPath:@"me/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];

Also used this code too :

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:4];
NSString *attachment = [NSString stringWithFormat:@"{'media': [{'type': 'mp3', 'src': '%@', 'title': '%@'}], 'messgae': 'Messgae Messgae Messgae', 'name': 'Name Name Name', 'href': '%@'}",amazon_link, title, link];
[params setObject:attachment forKey:@"attachment"];
[params setObject:text forKey:@"message"];
[params setObject:@"stream.publish" forKey:@"method"];
[facebook requestWithParams:params andDelegate:self];
like image 323
Amit Battan Avatar asked Nov 04 '22 20:11

Amit Battan


1 Answers

What solution from that link did you try? Post your own code. I also noticed that your audio link doesn't work, atleast not for me.

I think the correct way is to use the "source" field in the graph api, not "link".

This is a good page on the developer reference: http://developers.facebook.com/docs/reference/api/post/


To upload a video using the graph API you can do this. You also need to be authorized to the publish_stream permission.

NSString * file = [[NSBundle mainBundle] pathForResource:@"video" ofType:@"mov"];
NSData * video = [NSData dataWithContentsOfFile:file];
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
         @"title", @"title",
         @"description", @"description",
         video, @"video.mov",
         @"video/quicktime", @"contentType",
     nil];
[facebook requestWithGraphPath:@"me/videos"
                     andParams:dict
                 andHttpMethod:@"POST"
                   andDelegate:self];
like image 114
Jonathan Avatar answered Nov 09 '22 07:11

Jonathan