play URL audio using AVAudioPlayer
AVAudioPlayer is used to play audio file in iPhone. However, according to the document, it only support playing local audio file:
http://developer.apple.com/iphone/library/qa/qa2009/qa1634.html
To solve this problem, we can create a NSData using the NSURL and play the data using AVAudioPlayer
NSData *soundData = [NSData dataWithContentsOfURL:url];
AVAudioPlayer *avPlayer = [[AVAudioPlayer alloc] initWithData:soundData error: nil];
[avPlayer play];
Submitted by water on Thu, 2010-01-14 15:19

Recent comments
1 week 2 days ago
1 week 2 days ago
1 week 4 days ago
3 weeks 3 days ago
3 weeks 3 days ago
3 weeks 4 days ago
3 weeks 4 days ago
3 weeks 5 days ago
4 weeks 11 hours ago
4 weeks 1 day ago