如何为 AVPlayerViewController 设置 userinteractionEnabled: 为 NO?
How to set userinteractionEnabled: to NO for an AVPlayerViewController?
我尝试将 userinteractionEnabled: 设置为 AVPlayerViewController 的 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];
试试这个:
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
或者这个:
playerViewController.view.userInteractionEnabled = NO;
我尝试将 userinteractionEnabled: 设置为 AVPlayerViewController 的 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];
试试这个:
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
或者这个:
playerViewController.view.userInteractionEnabled = NO;