PlayerViewController的userinterac

PlayerViewController的userinterac

我尝试将AVPlayerViewController的userinteractionEnabled:设置为NO

[playerViewController setUserInteractionEnabled:NO];


但我有一个错误

"No visible @interface for 'AVPlayerViewController' declares the selector 'setUserInteractionEnabled:'"


没有可见的@interface
这是我完整的代码:

AVPlayer *player = [AVPlayer playerWithURL:videoURL];
AVPlayerViewController *playerViewController = [AVPlayerViewController new];
playerViewController.player = player;
  playerViewController.showsPlaybackControls = false;
    [playerViewController.player play];
[playerViewController setUserInteractionEnabled:NO];
    [self.navigationController pushViewController:playerViewController animated:YES];
[self performSelector:@selector(popToMain) withObject:nil afterDelay:durationInSeconds];


我只是希望人们在观看视频时不能在屏幕上单击。

提前致谢。

最佳答案

尝试这个:

 [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
 [[UIApplication sharedApplication] endIgnoringInteractionEvents];


或这个:

 playerViewController.view.userInteractionEnabled = NO;

关于ios - 如何将AVPlayerViewController的userinteractionEnabled:设置为NO?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50063770/

10-09 16:05