我正在从MPMoviePlayer迁移到AVPlayer / AVPlayerViewController。一切正常,除了当我通过屏幕控制缩放到全屏幕,电影结束播放后,全屏模式不会消失并卡在那里。我在iOS 9 beta 2上运行它。
这是我的代码:
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:url];
self.playerController.player = [AVPlayer playerWithURL:url];
self.playerController.view.frame = self.imageView.frame;
[self.view addSubview:self.playerController.view];
[self.playerController.player play];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(stopVideo:) name:AVPlayerItemDidPlayToEndTimeNotification object:nil];
当电影停止时,我运行以下stopVideo代码:
[self.playerController.player pause];
[self.playerController.view removeFromSuperview];
是我的代码还是iOS 9的错误?