let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(MainController.tapped(_:)))
tapRecognizer.allowedPressTypes = [NSNumber(integer: UIPressType.PlayPause.rawValue)]
self.view.addGestureRecognizer(tapRecognizer)
This code allows me to override the play/pause button and it works correctly. However, now I have to long press the Menu button to return to the Apple TV OS menu.
Is there anyway when the Menu button is pressed, it returns directly to the OS menu while the Play/Pause button keeps doing my current logic? I am afraid if clicking on Menu doesn't return to OS menu, my app could be rejected.
To return to the Apple TV home screen you can setup a
UITapGestureRecognizerin yourviewDidLoadlike so:and then in
handleMenuGestureyoususpendyour application:Related: Siri Remote's Menu Button not exiting application when UIButton is focused