problem in playing next song in the avaudioplayer

Posted by Rajashekar on Stack Overflow See other posts from Stack Overflow or by Rajashekar
Published on 2010-12-31T12:47:45Z Indexed on 2010/12/31 14:54 UTC
Read the original article Hit count: 140

Filed under:
|

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]; } }

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about avaudioplayer