我正在尝试使用最近在IOS9中引入的AVPictureInPictureController来播放视频,使用以下代码:
但屏幕上只显示AVPlayer,没有按钮或控件。。
我以前使用MPMoviePlayerViewController,但由于它在iOS 9中已正式弃用,我不能再使用它了。。
所以你能帮我显示_AVPictureInPictureController吗!!
提前致谢
AVPlayer *_AVPlayer = [AVPlayer playerWithURL:url];
AVPlayerLayer *_layer = [AVPlayerLayer playerLayerWithPlayer:_AVPlayer];
_layer.frame = [[UIApplication sharedApplication] delegate].window.bounds;
AVPictureInPictureController *_AVPictureInPictureController = [[AVPictureInPictureController alloc] initWithPlayerLayer:_layer];
_AVPictureInPictureController.delegate = self;
但是我怎样才能在屏幕上显示_AVPictureInPictureController?? 我尝试过
[self presentViewController:_AVPictureInPictureController animated:YES completion:nil];
并且
[self presentMoviePlayerViewControllerAnimated:_AVPictureInPictureController];
但是它没有成功 ):
另外我也尝试了
[self.view.layer addSublayer: layer];
但屏幕上只显示AVPlayer,没有按钮或控件。。
我以前使用MPMoviePlayerViewController,但由于它在iOS 9中已正式弃用,我不能再使用它了。。
所以你能帮我显示_AVPictureInPictureController吗!!
提前致谢