Is it possible to loop through a background song but skip the first 30 seconds when the song loops the next iterations? So during the first run, the entire song gets played, but from the second loop onwards, the loop skips the first 30 seconds of the song. This is for a game and the first 30 seconds is simply to get the user excited but the following loops is just the causal background music. Currently I've found on stackoverflow:
var AudioPlayer = AVAudioPlayer()
let AssortedMusics = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("backgroundMusic", ofType: "mp3")!)
AudioPlayer = try! AVAudioPlayer(contentsOfURL: AssortedMusics)
AudioPlayer.prepareToPlay()
AudioPlayer.numberOfLoops = -1
AudioPlayer.play()
For SwiftUI I'm guessing to put that into a function and run it inside an onAppear() when the game starts. But how'd I be able to play the beginning of the song only in the first loop?