0

I try to set userinteractionEnabled: to NO for an AVPlayerViewController

[playerViewController setUserInteractionEnabled:NO];

but I have an error

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

No visible @interface Here is my complete code:

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];

I just would like the people cannot click on the screen during the video.

Thanks in advance.

picciano
  • 22,341
  • 9
  • 69
  • 82
ΩlostA
  • 2,501
  • 5
  • 27
  • 63

2 Answers2

2

Maybe this might help you:

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
Nazar Lisovyi
  • 311
  • 1
  • 7
1

Try this:

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

or this:

 playerViewController.view.userInteractionEnabled = NO;
Salome Tsiramua
  • 763
  • 3
  • 9
  • 21