Play multiple audio files using AVAudioPlayer
Posted
by inScript09
on Stack Overflow
See other posts from Stack Overflow
or by inScript09
Published on 2010-04-06T15:59:28Z
Indexed on
2010/04/06
16:03 UTC
Read the original article
Hit count: 416
Hi all, I am planning on releasing 10 of my song recordings for free but bundled in an iphone app. They are not available on web or itunes or anywhere as of now.
I am new to iphone sdk (latest) as you can imagine, so I have been going through the developer documentation, various forums and stackoverflow to learn.
Apple's avTouch sample application was a great start. But I want my app to play all the 10 tracks one by one. All the songs are added to resources folder and are named as track1, track2...track10.
In the avTouch app code I can see the following 2 parts which is where I think I need to make changes to achieve what I am looking for. But I am lost.
// Load the array with the sample file
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"m4a"]];
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
{
if (flag == NO)
NSLog(@"Playback finished unsuccessfully");
[player setCurrentTime:0.];
[self updateViewForPlayerState];
}
can anyone please help me on
1. how to load the array with all the 10 tracks which are added to resources folder
2. and when I hit play, player should start the first track. when the 1st track ends 2nd track should start and so on for the remaining tracks.
Thank You
© Stack Overflow or respective owner