[TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

This forum is about all development around libVLC.
ssbmaccom
Cone that earned his stripes
Cone that earned his stripes
Posts: 184
Joined: 26 Nov 2015 15:21
Operating System: Mac OS, iOS, tvOS

[TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Postby ssbmaccom » 05 Oct 2017 18:34

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.

ssbmaccom
Cone that earned his stripes
Cone that earned his stripes
Posts: 184
Joined: 26 Nov 2015 15:21
Operating System: Mac OS, iOS, tvOS

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Postby ssbmaccom » 05 Oct 2017 18:51

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.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Postby Jean-Baptiste Kempf » 16 Oct 2017 06:09

Patch ios.m ?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

ssbmaccom
Cone that earned his stripes
Cone that earned his stripes
Posts: 184
Joined: 26 Nov 2015 15:21
Operating System: Mac OS, iOS, tvOS

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Postby ssbmaccom » 31 Oct 2017 13:03

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.

ssbmaccom
Cone that earned his stripes
Cone that earned his stripes
Posts: 184
Joined: 26 Nov 2015 15:21
Operating System: Mac OS, iOS, tvOS

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Postby ssbmaccom » 28 May 2019 16:11

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!!

mfkl
Developer
Developer
Posts: 740
Joined: 13 Jun 2017 10:41

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Postby mfkl » 29 May 2019 04:12

Open a merge request https://code.videolan.org/videolan/VLCKit
https://mfkl.github.io

ssbmaccom
Cone that earned his stripes
Cone that earned his stripes
Posts: 184
Joined: 26 Nov 2015 15:21
Operating System: Mac OS, iOS, tvOS

Re: [TVVLCKit] VLCMediaPlayer swallows UITapGesture Recognizers

Postby ssbmaccom » 06 Jun 2019 16:20

Hmm - even the patch would go into ios.m inside libvlc? At least this is not the right repository.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 26 guests