Page 1 of 1

[TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Posted: 05 Oct 2017 18:34
by ssbmaccom
Hi,

in my App I have defined a Gesture Recognizer für Play/Pause Button on AppleTV Remote. This worked fine for several versions of TVVLCKit but since a while (months), the method defined as action in the Storyboard is not called anymore. While experimenting - same happens with a Select (Click on Remote) UITapGestureRecognizer. All is fine in the Storyboard, other Gestures (swipe, tap, double-click) work.

I saw in VLCKit/libvlc/vlc/modules/video_output/ios.m Lines 517ff that libvlc is setting up its own gesture recognizers.

I tried to find this gesture recognizer in the view hierachy, but I was not able to detect it.

Code: Select all

viewContainer.superview
should be the view in my ViewController,which contains a plain UIView used as "drawable".

Any way to disable them as I do not need to react on DVD menu items?

Basic idea is, to mute LiveTV streams using Play/Pause as real play/pause actions do not make sense with LiveTV streams.

Any help/guidance welcome.

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Posted: 05 Oct 2017 18:51
by ssbmaccom
OK, I finally found the gesture recognizer, it simply exists a bit later.

Anyway this snippet still does not help even I remove the gesture recognizer:

Code: Select all

for ( UIGestureRecognizer *gest in self.view.gestureRecognizers ) { // ignore swipe gesture recognizers if ( gest.cancelsTouchesInView == NO ) [self.view removeGestureRecognizer:gest]; }
The recognizer gets removed, only my recognizers stay... but the gesture still does not work.

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Posted: 16 Oct 2017 06:09
by Jean-Baptiste Kempf
Patch ios.m ?

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Posted: 31 Oct 2017 13:03
by ssbmaccom
Well, patching ios.m would require to build TVVLCKit myself and I prefer to use a nightly build for releases of my App. For testing it would be OK, but not for releases.
Maybe you can send an event to (= call a method of) the mediaplayer delegate, when your gesture recognizer gets triggered? In this case, my App could intercept it. When teh delegate methods returns NO, it has handled the event, otherwise TVVLCKit can handle the event itself.

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Posted: 28 May 2019 16:11
by ssbmaccom
Hi Jean-Baptiste,

it has been quite a while in this area. But finally I found a way to change ios.m (in general) without breaking existing use cases in order to fix this topic. Actually building libVLC and VLCKit from source was troublesome here and then...

Idea is, that before the UITapGestureRecognizer gets initialized the code checks, if the parent UIViewController has implemented the tapRecognized: selector. If it does, the internal gesture recognizer is not set up, if not the code behaves as before. In order to disable libVLC/VLCKit swallowing UITapGesture, the UIViewController just needs to implement a dummy method like this:

Code: Select all

- (void)tapRecognized:(UITapGestureRecognizer *)tapRecognizer { (void)tapRecognizer; }
The method never gets called - it just needs to be implemented. OK, this is likely some sort of "hack".I used this one, basically, because the compiler already knows the selector for this method as there is a implementation of it in the same file.

It would be better to check for another method like: -(BOOL)wantsTapGestures- which could even go into the VLCKitDelegate protocol as optional. When it is not implemented or returns NO libvlc behaves as before - if present and returning YES, the internal UITapGesture Recognizer is not set up. But that is on top work and we could elaborate from my patch I would like to share with you.

I tried to send it directly to vlc-devel mailing list, but the email I am registered there does not allow sending (it is just an alias). I can send the patch via mail directly to you, I already it to Felix.

BTW: the patch also fixes small ambiguities that in very rare cases may lead to over-released or over-retained objects - either dangling pointers or memory leaks - but really very rare corner cases...

Let me know if interested!!

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Posted: 29 May 2019 04:12
by mfkl
Open a merge request https://code.videolan.org/videolan/VLCKit

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Posted: 06 Jun 2019 16:20
by ssbmaccom
Hmm - even the patch would go into ios.m inside libvlc? At least this is not the right repository.