How can I play a music such that it automatically replay it after its end?

AVAudioPlayer *myExampleSound;

NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:@"myaudiofile" ofType:@"caf"];

myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:NULL];

myExampleSound.delegate = self;

[myExampleSound play];

How can I play myExampleSound such that it automatically replay after its end? I am using the above code.

Anyone please help.


The AVAudioPlayerDelegate has got a method

- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag

which is called after the sound has finished playing. You have to implement this method and then you are able to play your sound again.

Need Your Help

TFS / VS 2012 RC - where is VSSConverter.exe?

visual-studio-2012 tfs2012 vssconverter

I am setting up a VM with a brand new install of TFS 2012 using the RC just released. This is the first time we have tried to use TFS in my company and I need to upgrade some SourceSafe databases. ...

Instrumentation of android apps

android instrumentation

I'm very new in testing and instrumentation, especially for Android, so please forgive me if my question will sounds odd.