ΩlostA
ΩlostA

Reputation: 2601

How to set userinteractionEnabled: to NO for an AVPlayerViewController?

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.

Upvotes: 0

Views: 199

Answers (2)

Salome Tsiramua
Salome Tsiramua

Reputation: 763

Try this:

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

or this:

 playerViewController.view.userInteractionEnabled = NO;

Upvotes: 1

Nazar Lisovyi
Nazar Lisovyi

Reputation: 311

Maybe this might help you:

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

Upvotes: 2

Related Questions