Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jackdvdripper

macrumors newbie
Original poster
Jul 16, 2010
6
0
I have the following code to play a video when a button is pushed in my app
Code:
- (IBAction)play {
	
	NSBundle *bundle = [NSBundle mainBundle];
	NSString *moviePath = [bundle pathForResource:@"mom" ofType:@"mp4"];
	NSURL  *movieURL = [[NSURL fileURLWithPath:moviePath] retain];
	MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
	theMovie.scalingMode = MPMovieScalingModeAspectFill;
	[theMovie play];
	
}
It played just fine until I upgraded my iPhone to iOS4. Now the audio will play, but not the video. Is there a reason for this?
 
Since 3.2 and really iOS4 there have been a few changes when is comes to playing movie. MPMoviePlayerController is sort of out now. MoviePlayerViewController is in (notice the View) have a look at the like below, download the source code and you will have it working in no time. Make sure you test on run for leaks on your device as you will see a few things wrong with the Sim. All the best...

Click Me for the Solution
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.