ios - AVAudioPlayer plays music in iPod touch 2G and 3G -


I am trying to run an audio file on iPhone and iPod touch with AVAudioPlayer . The code works fine in iPhones and iPod Touch 4G , I can listen to music but when I call it iPod Touch 2G , IPod touch 3G , so I can not hear anything.

Below is the code I use to play the audio file:

  NSString * zeroAudioPath = [[NSBundle main bundle] pathForResource: @ "TimerBold" type: @ "AIF "]; Ns URL * file = [[NSRL Alok] enterfile URL: zero audio tab]; Aviadio player * audioplayer = [[aviable player audio] initWithContentsOfURL: file error: zero]; [File release]; Self.zeroAudioPlayer = Audio Player; ZeroAudioPlayer.Climaget = Self; [Audioplayer release]; [To create zero audio player]; [Zero audio player play];    

I think changing from kAudioSessionCategory_PlayAndRecord to KAudioSessionCategory_AmbientSound Corrected this problem I suspect that it has something to do with the difference of hardware on the iPod touch related to the recording.


Comments