Play swift sound based on each duration of I time in array
问题 I want my swift code to call the playSound and play the sound based for the duration of each item in array playamount. So I want the user to play the sound for the first time for 10 seconds then play the sound starting at the beginning for 20 and then the same thing for 30 seconds. So the sound always starts at the beginning each time it is called. import UIKit; import AVFoundation class ViewController: UIViewController { var player: AVAudioPlayer? func playSound() { let url = Bundle