开发者

How to play soundcloud music in ios app?

I'm trying to play music from my profile in soundcloud, I downloaded sounCloud API project, but it looks very difficult, maybe 开发者_运维百科exist easiest way? Help me please. Thank you.


You should be able to make a GET request for the track you're trying to play:

[api performMethod:@"GET" 
        onResource:@"tracks" 
    withParameters:[NSDictionary dictionaryWithObject:@"12821506"  forKey:@"ids"] 
           context:context userInfo:nil];

You can then register a SCSoundCloudAPIDelegate and implement:

- (void)soundCloudAPI:(SCSoundCloudAPI *)soundCloudAPI 
    didFinishWithData:(NSData *)data 
              context:(id)context 
             userInfo:(id)userInfo;

If the context is equal to the context you passed in when making the GET request, you know your request is complete. You can build an NSDictionary modeling the response, and then grab the stream URL for streaming:

NSDictionary *trackInfo = [data objectFromJSONData];
NSString *steamURL = [trackInfo objectForKey:@"stream_url];

The full list of parameters you can specify when making the GET request is available here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜