Using the quick start guide provided would like to play a SoundCloud track within IOS app.
The code provided to play the stream is here:
SCAccount *account = [SCSoundCloud account];
[SCRequest performMethod:SCRequestMethodGET
onResource:[NSURL URLWithString:audioFile]
usingParameters:nil
withAccount:account
sendingProgressHandler:nil
responseHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
NSError *playerError;
audioPlayer = [[AVAudioPlayer alloc] initWithData:data error:&playerError];
audioPlayer.numberOfLoops = 0;
[audioPlayer prepareToPlay];
[audioPlayer play];
}];
Problem: is there a method to play a SoundCloud file without logging in to your SoundCloud account first? We hope all users consider using SoundCloud - however for usability if would be useful if new users could listen to a number of tracks before.
Saving content on mobile devicesIt is not possible to download a track from a mobile device. However, users with a SoundCloud Go or Go+ subscription can save content for offline listening on a mobile device.
In order to use SoundCloud with Android Auto, please make sure that you have downloaded the SoundCloud app and are logged in. All you have to do is select SoundCloud from the list of media services in your Library and choose a track to play.
Users can upload their own music/demos (or any shareable track) to SoundCloud, and then embed a SoundCloud music player on their sites. SoundCloud supports the uploading of AIFF, WAVE, FLAC, OGG, MP2, MP3, AAC, AMR, and WMA files.
Because beginning today, you can upload to SoundCloud directly from your phone. Within the SoundCloud app, tap the upward-pointing arrow on the top right of your home screen. Select any audio file from your phone (upload lossless HD files like FLAC, WAV, ALAC or AIFF for best audio quality).
For public access with the IOS Soundcloud SDK you will need to add the Soundcloud clientID as a parameter to your request string:
NSString *urlString = [NSString stringWithFormat:@"%@?client_id=%@", publicTrackUrlString, yourSCClientID];
[SCRequest performMethod: SCRequestMethodGET
onResource: [NSURL URLWithString:urlString]
usingParameters: nil
withAccount: nil
sendingProgressHandler: nil
responseHandler:^(NSURLResponse *response, NSData *data, NSError *error){
//
}];
Then it will work for public tracks when the withAccount: parameter is nil.
More elegantly, you can as well pack the "client_id" in a dictionary and use it with usingParameters:
NSDictionary *params = @{@"client_id": yourSCClientID} ;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With