Trust me, all the videos on you tube will work for earlier versions of iOS, but
I needed it to work for me in iOS 4.2, and after a lot of mix and match of code, found the following to
work well. Here is the code in the ViewController implementation :
//Get the Movie
NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:@”sample_iPod” ofType:@”m4v”];
NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain];
theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
//Place it in subview, else it won’t work
theMovie.view.frame = CGRectMake(0, 0, 480, 320);
//Resize window – a bit more practical
UIWindow *moviePlayerWindow = nil;
moviePlayerWindow = [[UIApplication sharedApplication] keyWindow];
[moviePlayerWindow setTransform:CGAffineTransformMakeScale(0.9, 0.9)];
// Play the movie.
I have this setting for LandScape on a iPhone 4.