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

sakthivadivel.a

macrumors newbie
Original poster
Oct 31, 2011
13
0
chennai - -India
Hi all,

I am working with audio player application, here i am having upto 15 songs i collected all the names into array and playing one by one as following,

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

if(prayerArray != nil)
{

int totalPrayersInQueue = [prayerArray count];
if(currentPlayingSongIndex < totalPrayersInQueue-1 )
{

currentPlayingSongIndex++;
NSString *sound = [prayerArray objectAtIndex:currentPlayingSongIndex];
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:sound ofType:mad:"mp3"]] error:nil];
player.delegate = self;
self.audioPlayer = player;
[player release];

// Set a timer which keep getting the current music time and update the UISlider in 1 sec interval
progressTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:mad:selector(updateSlider) userInfo:nil repeats:YES];


// Set the maximum value of the UISlider
progressSlider.maximumValue = audioPlayer.duration;

//NSLog(@"Current Song Duration %i",intValue(audioPlayer.duration));

// Set the valueChanged target
[progressSlider addTarget:self action:mad:selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];

// Play the audio
[audioPlayer prepareToPlay];
[audioPlayer play];

}
else {

[playButton setImage:[UIImage imageNamed:mad:"Play_icon.png"] forState:UIControlStateNormal];
}

}


}


Here i want to introduce a delay of 15 seconds between each songs, is there a way and how to do that inside a delegate method.

Thanks in advance.

Regards
sakthi
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.