I am using MPMoviePlayerController to play a video inside my iPad application. I am using below code snippet to add the movie player to view:
self.player =[[MPMoviePlayerController alloc] initWithContentURL: urlVideo];
[self.player prepareToPlay];
[self.player setMovieSourceType:MPMovieSourceTypeStreaming];
[self.player.view setBounds:CGRectMake(0, 0, 512, 374)];
if (UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation))
{
NSLog(@"landscape..");
[self.player.view setCenter:CGPointMake(512, 374)];
}
else{
NSLog(@"portrait.");
[self.player.view setCenter:CGPointMake(384, 502)];
}
self.player.controlStyle=MPMovieControlStyleEmbedded;
[self.player setScalingMode:MPMovieScalingModeAspectFit];
self.player.shouldAutoplay=YES;
[self.viewController.view addSubview: self.player.view];
self.btnCloseNormalMode= [UIButton buttonWithType:UIButtonTypeCustom];
[self.btnCloseNormalMode setImage:[UIImage imageNamed:@"close_button_icon.png"] forState:UIControlStateNormal];
[self.btnCloseNormalMode setFrame:CGRectMake(470, 5, 32, 32)];
[self.btnCloseNormalMode addTarget:self action:@selector(onSmallCloseBtnTap) forControlEvents:UIControlEventTouchUpInside];
[self.player.view addSubview:self.btnCloseNormalMode];
But as understandable from the above code, its adding on the view abruptly. Suddenly one black view appears on the view which is not user friendly. We want to add the movie player view with some animation to make it smooth. Can I make the movie player view to come with a animation like how modal appears or any suitable UIView animation. But I have no idea regarding animation. Could someone please help me on this !!! Thanks.