我有一个以此方式创建的AVPlayerViewController
:
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSURL *videoURL = [NSURL URLWithString:@"testURL"];
AVPlayer *player = [AVPlayer playerWithURL:videoURL];
AVPlayerViewController *playerViewController = [AVPlayerViewController new];
playerViewController.player = player;
[playerViewController.player play];
[playerViewController.view setFrame:CGRectMake(0, 0, 300, 300)];
[self.view addSubview:playerViewController.view];
[self addChildViewController:playerViewController];
int width = 100;
int height = 150;
int xPosition = self.view.frame.size.width - width;
int yPosition = 100;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
playerViewController.view.frame = CGRectMake(xPosition, yPosition, width, height);
[UIView commitAnimations];
}
我的问题是,通过这种方式我得到了:
playerViewController.view的动画与 视频和playerViewController.view逐渐减少,而视频 立即减少。
我不明白为什么。
如果需要的话,我可以链接一段我得到的视频