Hi, I want to check if right part is tapped on the touchpad of the remote, and below is my code:
- (void)viewDidLoad {
[super viewDidLoad];
AVPlayer *avPlayer = [AVPlayer playerWithURL:[NSURL URLWithString:@"http://techslides.com/demos/sample-videos/small.mp4"]];
AVPlayerLayer *avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:avPlayer];
avPlayerLayer.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[self.view.layer addSublayer:avPlayerLayer];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
tap.allowedPressTypes = @[@(UIPressTypeRightArrow)];
[self.view addGestureRecognizer:tap];
[avPlayer play];
}
- (void)handleLongPress:(UILongPressGestureRecognizer*)sender {
NSLog(@"hello world");
}
Everything works except the tap gesture. The funny thing is this code works good with the old remote. Also, if I remove the line: "tap.allowedPressTypes...", everything works.
Anyone has the idea what is the correct way to detect right part is tapped of the remote? And why does the code work good with the old remote while not with the new one?
Thank you in advance.