Posted By

gfazioli on 12/01/09


Tagged

streaming mp3 Objective-c


Versions (?)

Who likes this?

8 people have marked this snippet as a favorite

umang_nine
iswear_wxp
avanadra
adison
joshparnham
bobbym245
yannxou
chrisaiv


Streaming mp3 file su Apple iPhone


 / Published in: iPhone
 

URL: http://www.undolog.com

  1. NSString * soundFilePath = @"http://www.server.com/test.mp3";
  2.  
  3. NSURL * fileURL = [NSURL URLWithString:soundFilePath];
  4. NSURLRequest * request = [NSURLRequest requestWithURL:fileURL];
  5. NSData *dataRaw = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
  6.  
  7. AVAudioPlayer * audioPlayer = [[AVAudioPlayer alloc] initWithData:dataRaw error:nil];
  8.  
  9. [audioPlayer play];

Report this snippet  

You need to login to post a comment.