Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mandude

macrumors member
Original poster
Nov 19, 2009
64
0
hey if anyone wants to help i'd really appreciate it. So i got this beautiful song that starts playing on the viewDidLoad method. now i just need to to play over and over and over again.... thanks.. here's the code:


h. file:
@implementation....... {
NSString *playerPath;
AVAudioPlayer *player;
}
@propoperty (nonatomic, retain) NSString *playerPath;
@propoperty (nonatomic, retain) AVAudioPlayer *player;
@end



m. file:

-(void)viewDidLoad {

playerPath = [[NSBundle mainBundle] pathForResource:mad:"Vengeance" ofType:mad:"mp3"];

player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:playerPath] error:NULL];

[player play];
}
 
Try this
Code:
player.numberOfLoops = -1;
From the docs, a negative number indicates it loops forever.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.