I have an AVAudioPlayerNode (playerNode) and two AVAudioPCMBuffer (buffer1, buffer2) setup.
I also have a AVAudioTime (futureTime) setup for 10 seconds.
var options: AVAudioPlayerNodeBufferOptions = []
options.insert(.interruptsAtLoop)
options.insert(.loops)
playerNode.scheduleBuffer(buffer1!,
at: futureTime,
options: options,
completionHandler:nil)
The above plays buffer1 after waiting 10 seconds and keeps playing it in a loop.
Calling the following code:
playerNode.scheduleBuffer(buffer2!,
at: futureTime,
options: options,
completionHandler:nil)
Is causing buffer1 to stop playing and buffer2 to start immediately instead of waiting at least 10 seconds and then interrupting at the next loop of buffer1.
Any ideas what I'm doing wrong that is causing this immediate interruption instead of interrupting at the loop as instructed?