开发者

check if music is played [closed]

开发者 https://www.devze.com 2023-02-22 23:00 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this
Closed. This question needs to be more focused. It is not currently accepting answers.

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 question

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消