当用户点击按钮时,我会显示如下的AVPlayerViewController:
self.playerViewController = [[AVPlayerViewController alloc] init];
self.playerViewController.player = [AVPlayer playerWithURL:url];
[self presentViewController:self.playerViewController animated:YES completion:^{
[self.playerViewController.player play];
}];
属性playerViewController
定义为:
@property (nonatomic, strong) AVPlayerViewController *playerViewController;
我注意到每次按下视图控制器中的按钮开始视频播放时,应用程序会消耗更多内存。在使用Instruments进行分析后,我看到AVPlayerViewController实例未被释放,例如在开始播放视频两次后,我看到了:
基础SDK:9.3 部署目标:8.3