1
J'ai ce code pour jouer un son, mais la première fois que vous jouez il faut un bon 5 secondes pour charger ...Cocoa Touch - Chargement AVAudioPlayer
Comment puis-je accélérer ce?
-(IBAction)playSound{ //play the cricket noise
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"Cricket_Sound" ofType:@"mp3"];
audioPlayer =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:soundPath] error:NULL];
audioPlayer.delegate = self;
[audioPlayer prepareToPlay];
audioPlayer.numberOfLoops = 0;
[audioPlayer play];
}