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
4 days 13 hours ago
6 days 11 hours ago
6 days 11 hours ago
1 week 1 day ago
1 week 2 days ago
1 week 2 days ago
1 week 3 days ago
1 week 4 days ago
1 week 4 days ago
1 week 6 days ago