iOS 13需要LinearPlayback

时间:2019-10-23 02:06:20

标签: ios avplayerviewcontroller

我正在制作一个有视频的应用程序。我从后端获取链接并仅在 AVPlayerViewController 中显示视频,但是我想删除前进和后退的功能我从后端获得的标志上的视频片段。对于某些视频,它可以正常工作,而对于某些视频,则存在一些限制。我设置了 requirementsLinearPlayback 。在Xcode 10上构建,但在Xcode 11上崩溃

- (void)configVideoView {
    NSURL *webVideoUrl = [NSURL URLWithString:self.videoURL];
    self.avPlayerVC = [[AVPlayerViewController alloc] init];
    [self.avPlayerVC setValue:false forKey:@"requiresLinearPlayback"];
    self.avPlayerVC.player = [AVPlayer playerWithURL:webVideoUrl];
    self.avPlayerVC.view.frame = CGRectMake(0, 0, DEF_SCREEN_WIDTH, 320);
    [self addChildViewController:self.avPlayerVC];
    [self.view addSubview:self.avPlayerVC.view];
    self.avPlayerVC.accessibilityElementsHidden = false;
    self.avPlayerVC.showsPlaybackControls = true;
    self.avPlayerVC.view.userInteractionEnabled = true;
    [self.avPlayerVC.player play];
}

0 个答案:

没有答案