i 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With