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

arnieterm

macrumors regular
Original poster
Aug 28, 2008
201
0
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:mad:"first", @"second", @"third", @"fourth", nil];
--------------------------------------------------------------------------------------------------------------------------------
NSURL* audioFileUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:[soundFiles objectAtIndex:0] ofType:mad:"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.
 

neil.b

macrumors member
Nov 20, 2008
65
0
Use the audioPlayerDidFinishPlaying delegate to step through each sound in the array.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.