Search code examples
iosavaudioplayer

AVAudioPlayer makes click/pop noise when song is started/stopped


I'm using AVAudioPlayer to play a music file. When I call start or stop, there's an audible "click" or "pop" noise. I've tried it with both mp3 and caf files, and hear it in both cases (though I don't hear it every single time). Does anyone know how to prevent these glitchy noises?


Solution

  • For anyone who happens upon this in the future, you have to turn the AVAudioPlayer's volume down to 0, then call stop ~0.5s later.