Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
开发者_JAVA百科 Improve this questioni use avaudioplayer to play own music in my app. is there a possibility to check if music from the avaudioplayer is playing?
Use the playing property, i.e.:
AVAudioPlayer *audioplayer;
if(audioplayer.playing){
//do what you want here
}
Also refer to the class reference of AVAudioPlayer.
The class reference states you shouldn't poll this property though. If you want to find out if a song has finished playing, use an AVAudioPlayerDelegate
. The audioPlayerDidFinishPlaying:successfully:
function will inform you when the audio player finished playing audio.
精彩评论