Reputation:
I'm trying to display an image while a sound is playing. I can get it to appear, but I'm having trouble making it disappear once the sound has finished playing.
-(IBAction)guitarChord:(id)sender
{
if (theAudio.playing == YES) {
theAudio.stop;
theAnimation.stop;
} else {
theAudio.play;
theAnimation.play;
}
}
I'm using AVAudioPlayer.
Any ideas what I am doing wrong?
How do I detect a sound has stopped?
Upvotes: 2
Views: 279
Reputation: 3344
Briefly, you need to take a look at AVAudioPlayerDelegate and audioPlayerDidFinishPlaying.
Upvotes: 2