An alternative is to add another view (for example, a simple black background), and then replace it after the video has finished playing:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:@"Hafez-2" ofType:@"mov"];
NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain];
MPMoviePlayerController *IntroMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
[IntroMovie setOrientation:UIDeviceOrientationPortrait animated:NO];
[IntroMovie play];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlaybackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
UIView* blackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
blackView.backgroundColor = [UIColor blackColor];
[window addSubview:blackView];
[blackView release];
[window makeKeyAndVisible];
}
- (void) moviePlaybackDidFinish:(NSNotification*)notification
{
UIView* blackView = [[window subviews] objectAtIndex:0];
[blackView removeFromSuperview];
[window addSubview:viewController.view];
}
Let me know if you need a modified source from your example and I can send it somewhere
source
share