Use the play property, i.e.:
AVAudioPlayer *audioplayer; if(audioplayer.playing){
Also see the AVAudioPlayer class link .
A class reference indicates that you should not poll this property. If you want to know if a song has ended, use AVAudioPlayerDelegate . The audioPlayerDidFinishPlaying:successfully: function audioPlayerDidFinishPlaying:successfully: will audioPlayerDidFinishPlaying:successfully: you when the audio player finishes playing sound.
Tovi7 source share