我正在从服务器播放音频文件,但如果我播放本地文件则它不播放,那么它在这里播放是我的代码。
//NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/audiofile.mp3", [[NSBundle mainBundle] resourcePath]]];
NSURL *url = [NSURL URLWithString:@"http://celeritas-solutions.com/pah_brd_v1/productivo/1.mp3"];
NSError *error;
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
audioPlayer.numberOfLoops = -1;
if (audioPlayer == nil)
NSLog([error description]);
else
[audioPlayer play];