2011-09-05 42 views

回答

0

您應該使用AVFoundation框架。您可以使用這樣的AVAudioPlayer類:

NSString * fPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"audiofile.mp3"]; 
NSURL * url = [NSURL fileURLWithPath:fPath]; 
AVAudioPlayer * audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url 
                    error:nil]; 
audioPlayer.numberOfLoops = -1; 
[audioPlayer play]; 
相關問題