problem in playing next song in the avaudioplayer
- by Rajashekar
Hello friends
my delegate method looks like this. after the first song is played it goes into this method and plays the second song , however when the second song is done playing it stops. it does not go into the delegate method.i need to play all the songs continuously. i am not sure, why. can someone help me.
(void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)p successfully:(BOOL)flag
{
if (flag == NO)
NSLog(@"Playback finished unsuccessfully");
else
{
//[player stop];
index++;
NSLog(@"%d",index);
path=[[NSBundle mainBundle] pathForResource:[songlist objectAtIndex:index] ofType:@"mp3"];
[player initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
[songlabel2 setTitle:[songlist objectAtIndex:index]];
[endtime setText:[NSString stringWithFormat:@"%.2f",[player duration]/100]];
[player play];
}
}