Objective-C: AudioOutputUnitStart takes a long tim

2019-08-30 06:08发布

问题:

AudioOutputUnitStart function takes up to 1-2 seconds to start every time I call it. I use AudioOutputUnitStop to stop it, is there something like AudioOutputUnitPause so that it only takes this much to start first time? Or do I have to keep it all the time started and output silence when "stopped" (this doesn't seem right)

Thanks!

EDIT: The sound I play it's pretty short (under a second, streaming continuously ) so I don't think it's that, probably that's how much it usually takes no matter the sound size.

回答1:

Try to decrease your buffer size for your audio data. iOS will not begin playing until the first buffer is filled with data. If this buffer size is quite big, it might take 1-2 seconds.