I am developing an iphone application which will play multiple sound files one by one continuously. And it will be played in background so i can not use the MVMediaPlayer as this adds a view controller to the current view that is not needed for my application. I can play a single sound file using
NSArray soundFiles = [[NSArray alloc] initWithObjects"first", @"second", @"third", @"fourth", nil];
--------------------------------------------------------------------------------------------------------------------------------
NSURL* audioFileUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:[soundFiles objectAtIndex:0] ofType"aif"]];
self.AudioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:audioFileUrl error:nil];
self.AudioPlayer.delegate = self;
[self. AudioPlayer play];
The above code works perfect but how can i play other songs.I want the sounds to be played in sequence so that the second sound play at the end of first and so on Please help me it's urgent.
NSArray soundFiles = [[NSArray alloc] initWithObjects"first", @"second", @"third", @"fourth", nil];
--------------------------------------------------------------------------------------------------------------------------------
NSURL* audioFileUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:[soundFiles objectAtIndex:0] ofType"aif"]];
self.AudioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:audioFileUrl error:nil];
self.AudioPlayer.delegate = self;
[self. AudioPlayer play];
The above code works perfect but how can i play other songs.I want the sounds to be played in sequence so that the second sound play at the end of first and so on Please help me it's urgent.