我正在尝试播放 2 首它们应该使用循环选项依次播放的音乐,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSString * music = [[NSBundle mainBundle] pathForResource:@"music" ofType:@"wav"];
myMusic = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:music] error:NULL];
myMusic.delegate = self;
[myMusic play];
}
并播放第二首音乐:
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag {
NSString * music = [[NSBundle mainBundle] pathForResource:@"music2" ofType:@"wav"];
myMusic = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:music] error:NULL];
myMusic.delegate = self;
[myMusic play];
NSLog(@"MUSIC FINISH");
}
现在的问题是如何播放以前的音乐?