I have a page on an iPad that is setup so there are a bunch of characters and background music. Tapping on a character will start an animation and the character will play along with the music. The problem is, the music and animations are getting out of sync and there's probably a better way.
Here is how I'm doing it.
• page loads
• I add the still versions of the characters as UIImageViews
• I create AVAudioPlayer objects for each of the character's instruments, start them playing and set volume to 0.
• I add the animated versions of the characters as UIImageViews with a png sequence, position above the still versions and hide them. (there are buttons that throw visibility and volume switches)
When I demo this, the audio starts playing before the page loads and some characters get really out of sync. What should I be doing differently? How can I sync these up? Is this the totally wrong approach? I'm kind of new at this.