Question

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
Was it helpful?

Solution

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 MPMoviePlayerController documentation.

In particular, you may want to try calling the prepareToPlay method on the movie player.

OTHER TIPS

I suppose that you define it within function?

if you use ARC, you have to retain MPMoviePlayerController

Add it to interface file!

@property(nonatomic, strong) MPMoviePlayerController *moviePlayer;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top