0

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.

Rashmi Ranjan mallick
  • 6,390
  • 8
  • 42
  • 59
  • how to want display like progress bar or like activity indicator – Shanthanu Jun 20 '14 at 08:00
  • @user3614966: I think you didn't get my problem. I already have an activity indicator in place. May be my question was not clear also !!! I slightly changed my question now. I want the movie player view to appear with a animation on the screen. – Rashmi Ranjan mallick Jun 20 '14 at 10:26
  • check my answer below i have given the sample code it will work.. – Shanthanu Jun 20 '14 at 10:41

0 Answers0