- (void)viewDidLoad {
[super viewDidLoad];
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/audiofile.mp3", [[NSBundle mainBundle] resourcePath]]];
NSError *error;
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
audioPlayer.numberOfLoops = -1;
audioPlayer.delegate = self;
if (audioPlayer == nil)
NSLog([error description]);
else
[audioPlayer play];
}
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
{
if(successfully)
NSLog(@"Played successfully");
}
- (void)audioPlayerBeginInterruption:(AVAudioPlayer *)player
{
NSLog(@"Interreption occured");
}
- (void)audioPlayerEndInterruption:(AVAudioPlayer *)player
{
NSLog(@"Interreption Ended");
}
No comments:
Post a Comment