Loop background music? [closed] Loop background music? [closed] objective-c objective-c

Loop background music? [closed]


You can use the AVAudioPlayer:

NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"mySound" ofType:@"mp3"];NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:nil];player.numberOfLoops = -1; //infinite[player play];

and you can jump through by setting the currentTime:

player.currentTime = 10; //jump to 10th second