我正在制作一个应用程序,我已经实现了AVPLayer。我从后端获取链接并仅在AVPlayer中显示视频,但我想删除前进和返回视频的功能我是从后端获取。对于某些视频它会正常工作,对于某些视频会有限制。另外,我想知道视频完成时间。我怎么能实现它?
@property (nonatomic) AVPlayerViewController*
videoPlayerViewController;
self.videoPlayerViewController.delegate = self;
self.videoPlayerViewController.player = self.videoPlayer;
self.videoPlayerViewController.showsPlaybackControls = YES;
self.videoPlayer.closedCaptionDisplayEnabled = NO;
self.videoPlayerViewController.allowsPictureInPicturePlayback = YES;
self.videoPlayerViewController.videoGravity = AVLayerVideoGravityResizeAspect;
[self.videoPlayerViewController setValue:false forKey:@"requiresLinearPlayback"];
CGRect videoFrame = self.videoPlayerView.bounds;
[self.videoPlayerViewController.view setFrame:videoFrame];
//[self dismissViewControllerAnimated:true completion:nil];
[self addChildViewController:self.videoPlayerViewController];
[self.videoPlayerView addSubview:self.videoPlayerViewController.view];
[self.videoPlayerThumbnailView setHidden:YES];
[self.videoPlayer play];
答案 0 :(得分:1)
将requiresLinearPlayback
设置为false
以禁用播放。
self.playerController.setValue(false, forKey: "requiresLinearPlayback")
这是doc。