I have an iPad 1 with iOS 4.2, running an app compiled using Xcode 3.2.5.
The app is implemented using cocos2D framework 1.0.
At a point somewhere in the middle of the app, I would like to introduce a video cut sequence to my game. I instantiate MPMoviePlayerController and use it to play an embedded mp4 file. Once the video starts playing, however, the audio and video are out of sync by as much as 1 second (which, in this case is a lot).
The video file is encoded using H.264 encoding following the iPad guidelines specified by Apple
here. However, I've experimented with a variety of other video and audio formats, but to no avail.
I even tried listening to the MPMoviePlayerLoadStateDidChangeNotification message where the player loadState changes to MPMovieLoadStatePlaythroughOK and waiting for 5 seconds after receiving that message to initiate playback, but that didn't help. Using the autoplay feature of MPMoviePlayerController had no effect either.
Does anyone have any suggestions of what else I could try? I couldn't find the mention of this issue anywhere on the web, except for
here, but that "fix" doesn't quite apply to me since I'm embedding a video mid-game.