Hello everyone,
I'm trying to play an audio file in iPhone and iPod with AVAudioPlayer,
the code works fine in iPhone and iPod touch 4th generation, I could hear the music.
but when I test it on iPod touch 2nd, iPod touch 3rd, I couldn't hear anything.
Below is the code I use for playing audio file, is there anything I miss here:
NSString *zeroAudioPath = [[NSBundle mainBundle] pathForResource:@"TimerBell" ofType:@"aif"];
NSURL *file = [[NSURL alloc] initFileURLWithPath:zeroAudioPath];
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:file error:nil];
[file release];
self.zeroAudioPlayer = audioPlayer;
zeroAudioPlayer.delegate=self;
[audioPlayer release];
[zeroAudioPlayer prepareToPlay];
[zeroAudioPlayer play];
Thank you for reading!