0

我尝试将 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];

我只是希望人们在视频期间不能点击屏幕。

提前致谢。

4

2 回答 2

2

也许这可以帮助你:

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
于 2018-04-27T13:48:12.270 回答
1

试试这个:

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

或这个:

 playerViewController.view.userInteractionEnabled = NO;
于 2018-04-27T14:24:28.547 回答