I was very delighted to see that when “upgrading” to Xcode 4.5, now none of the videos in my app play at all.
Generally I do something like this:
self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[self getBundleClip:@"theVideo"]];
self.moviePlayer.controlStyle = MPMovieControlStyleNone;
self.moviePlayer.shouldAutoplay = YES;
self.moviePlayer.repeatMode = MPMovieRepeatModeOne;
self.moviePlayer.view.frame = self.container.frame;
self.moviePlayer.view.userInteractionEnabled = NO;
[self.container addSubview:self.moviePlayer.view];
- (NSURL*)getBundleClip:(NSString*)clip
{
NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:clip ofType:@"mp4"];
return [NSURL fileURLWithPath:moviePath];
}
Again, everything played perfectly before I updated Xcode to 4.5. Anyone else have this issue?
I also get this output:
[MPAVController] Autoplay: Disabling autoplay for pause
[MPAVController] Autoplay: Disabling autoplay
I’m not sure why it is not playing specifically, but it looks like behavior is different depending on which version of iOS SDK you build against. Look at the
MPMoviePlayerControllerdocumentation.In particular, you may want to try calling the
prepareToPlaymethod on the movie player.