Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
iOS Development
AVAudioPlayer lag issue?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Mark FX" data-source="post: 1615657" data-attributes="member: 211556"><p>I have not done anything with the AVAudioPlayer class myself for a while, but the problem is the fact that the your playSound: method is creating and initializing the AVAudioPlayer class, then loading the URL or Data from a sound file, then also preparing itself to be able to manipulate the sound file, so thatt's the reason for the lag time your experiencing.</p><p></p><p>You should try to initialize and pepare the AVAudioPlayer well before you need it to play, perhaops in another method, after the user has selected a sound file in a list, or from a file open dialog box.</p><p>That way the play button and corresponding play method is only having to tell the AVAdioPlayer to play only, and that should reduce the time lag a bit, but by how much migth take some experimentation.</p><p></p><p>Regards Mark</p></blockquote><p></p>
[QUOTE="Mark FX, post: 1615657, member: 211556"] I have not done anything with the AVAudioPlayer class myself for a while, but the problem is the fact that the your playSound: method is creating and initializing the AVAudioPlayer class, then loading the URL or Data from a sound file, then also preparing itself to be able to manipulate the sound file, so thatt's the reason for the lag time your experiencing. You should try to initialize and pepare the AVAudioPlayer well before you need it to play, perhaops in another method, after the user has selected a sound file in a list, or from a file open dialog box. That way the play button and corresponding play method is only having to tell the AVAdioPlayer to play only, and that should reduce the time lag a bit, but by how much migth take some experimentation. Regards Mark [/QUOTE]
Verification
What is Apple's smallest desktop computer called?
Post reply
Forums
macOS & iOS Developer Playground
iOS Development
AVAudioPlayer lag issue?
Top