here is my code
NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"95" ofType:@"wav"]; NSError *activationError = nil; NSError *audioPlayerInitError = nil; [[AVAudioSession sharedInstance] setActive: YES error:&activationError]; NSURL *newURL = [NSURL fileURLWithPath:soundFilePath]; musicPlayer1 = [[AVAudioPlayer alloc] initWithContentsOfURL:newURL error:&audioPlayerInitError]; if (musicPlayer1) { [musicPlayer1 stop]; [musicPlayer1 release]; musicPlayer1 = nil; } else { [musicPlayer1 prepareToPlay]; [musicPlayer1 setVolume:.8]; [musicPlayer1 setNumberOfLoops:-1];
}
I am going to start and stop AVAudioPlay with the same button (musicPlayer1 is in the header). Now, when I touch the button, it does not play anything. Help me please?
source share