On playing more than 1 songs using AVAudio Player
when the first song get finished - (void)audioPlayerDidFinishPlaying:successfully:
get called .
if i use that code it works
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
{
NSString *tempString = @"/";
tempString = [tempString stringByAppendingString:name];
NSString *path = [NSString stringWithFormat:@"%@",[[NSBundle mainBundle] resourcePath]];
path = [path stringByAppendingString:tempString];
NSURL *url = [NSURL fileURLWithPath:path];
NSError *error;
AVAudioPlayer *audioPlayer101 = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
[AppDelegate getAppdelegate].audioPlayerForPlay = audioPlayer101;
[[AppDelegate getAppdelegate].audioPlayerForPlay play];
}
It works
however if i does not put the instance in perdefined property of audio player it doesnot play.
here is that code
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
{
NSString *tempString = @"/";
tempString = [tempString stringByAppendingString:name];
NSString *path = [NSString stringWithFormat:@"%@",[[NSBundle mainBundle] resourcePath]];
path = [path stringByAppendingString:tempString];
NSURL *url = [NSURL fileURLWithPath:path];
NSError *error;
AVAudioPlayer *audioPlayer101 = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
[audioPlayer101 play];
}