How do I repeat a AVAudioPlayer?

后端 未结 3 1631
傲寒
傲寒 2020-12-29 17:27

I am just wondering how you repeat a AVAudioPlayer?

3条回答
  •  执念已碎
    2020-12-29 18:07

    Do you mean 'How do I set an AVAudioPlayer to repeat a sound?' I assume?

    if so:

    Notice that AVAudioPlayer class has a property called numberOfLoops. If you set this property to a negative integer value, when you play the AVAudioPlayer, it will loop until stopped. You can set the number of loops you'd like to play by making numberOfLoops a positive integer.

    Hope that helps!

提交回复
热议问题