AVAudioPlayer stop a sound and play it from the beginning

后端 未结 3 1391
旧时难觅i
旧时难觅i 2021-02-05 03:25

I used the AVAudioPlayer to play a 10 sec wav file and it works fine. Now I what to stop the wav at the 4th sec and then play it again from the very 1st sec.

Here is th

3条回答
  •  情话喂你
    2021-02-05 03:33

    Swift:

    mySound.audioPlayer?.stop()
    mySound.audioPlayer?.currentTime = 0
    mySound.audioPlayer?.play()
    

提交回复
热议问题