AVAudioPlayer lag when calling play

Posted by joec on Stack Overflow See other posts from Stack Overflow or by joec
Published on 2011-02-28T22:30:43Z Indexed on 2011/02/28 23:25 UTC
Read the original article Hit count: 255

I have set up an AVAudioPlayer object in viewDidLoad, as per the Apple guidelines, calling prepareToPlay as the last line in viewDidLoad (i have tried in awakeFromNib also).

When i press my play button, there is a pause, as it would appear to load the file, then it plays.

In audioPlayerDidFinishPlaying, i reload the player with a different sound, and when clicking play for a second time, the file plays instantly.

What would cause the player to lag on the first play?

Thanks.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c