Hello,
I'm adding a video as a subview and fading it in. Even though the background image and the video's first frame are identical, the screen darkens for a little while as the video fades in. Here's the code:
Code:
-(void) playMovie:(NSString *)movie
{
NSArray *movieElements = [movie componentsSeparatedByString:@"."];
NSString *url = [[NSBundle mainBundle]
pathForResource:[movieElements objectAtIndex:0]
ofType:[movieElements objectAtIndex:1]];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL fileURLWithPath:url]];
CGRect frame = [[UIScreen mainScreen] bounds];
[[player view] setFrame:CGRectMake(frame.origin.x, frame.origin.y, frame.size.height, frame.size.width)]; // play in landscape mode
player.controlStyle = MPMovieControlStyleNone;
player.view.alpha = 0;
[self.view addSubview: player.view];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
player.view.alpha = 1;
[UIView commitAnimations];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedFadeOut:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
player.fullscreen = NO;
[player play];
}
I'm losing my hair. Not over this, but it sure doesn't help.
Thanx in advance,
Nir.