AVPlayerViewController上的动画未同步

时间:2018-08-23 13:20:05

标签: ios uiviewanimation avplayerviewcontroller avplayerlayer

我有一个以此方式创建的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逐渐减少,而视频   立即减少。

我不明白为什么。

如果需要的话,我可以链接一段我得到的视频

0 个答案:

没有答案