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.
Maybe this might help you:
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
Try this:
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
or this:
playerViewController.view.userInteractionEnabled = NO;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.