question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GestureRecognizer attached to VideoView never gets called.

See original GitHub issue

I have a simple view view to which I am trying to add a gesture recognizer to hide\show the video controls. However, the gesture recognizer never gets hit.

The below is ain a

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
			 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
			 xmlns:local="clr-namespace:Trial.Helpers;assembly=Trial"
			 xmlns:forms="clr-namespace:Plugin.MediaManager.Forms;assembly=Plugin.MediaManager.Forms"
			 xmlns:plugin="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
			 x:Class="Trial.ViewsModels.VideoPage"
			 Title="{Binding ActivityCode}" BackgroundColor="Black">
	<ContentPage.Resources>
		<ResourceDictionary>
			<local:PrettyDateConverter x:Key="prettyDateConverter" />
		</ResourceDictionary>
	</ContentPage.Resources>
	<ContentPage.ToolbarItems>
		<ToolbarItem Text="Done" Icon="delete.png" x:Name="DoneToolBarItem" />
	</ContentPage.ToolbarItems>
	<StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand" Margin="0,30,0,20" x:Name="mainStack">
		<Label x:Name="statusLabel" FontSize="Micro" TextColor="#FFFFFF" HorizontalTextAlignment="Center" 
			   VerticalTextAlignment="Center" HeightRequest="20"></Label>
		<Grid VerticalOptions="Fill" >
			<Grid.RowDefinitions>
				<RowDefinition Height="10*"/>
				<RowDefinition Height="1*"/>
			</Grid.RowDefinitions>

			<forms:VideoView x:Name="player"
			Grid.Row="0" Grid.RowSpan="1" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" AspectMode="AspectFill"/>

			<Grid HorizontalOptions="FillAndExpand" Grid.Row="1" Grid.RowSpan="1" x:Name="gridControls">
				<Grid.RowDefinitions>
					<RowDefinition Height="50"/>
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="50"/>
					<ColumnDefinition Width="*"/>
				</Grid.ColumnDefinitions>
				<Button Image="play.png" Grid.Column="0" x:Name="play"></Button>
				<Button Image="pause.png" x:Name="pause" Grid.Column="0"></Button>
				<ProgressBar x:Name="progress" VerticalOptions="CenterAndExpand" Grid.Column="1" BackgroundColor="Gray" HorizontalOptions="FillAndExpand"></ProgressBar>
			</Grid>

		</Grid>
	</StackLayout>
</ContentPage>

OnAppearing is as follows:

        protected override void OnAppearing()
        {
            base.OnAppearing();
            CrossMediaManager.Current.Stop();
            CrossMediaManager.Current.StatusChanged += CurrentOnStatusChanged;
            CrossMediaManager.Current.PlayingChanged += OnPlayingChanged;
            player.Source = ca.FollowUpCode;
            pause.IsEnabled = false;
            pause.IsVisible = false;
            play.Clicked += OnPlayClicked;
            pause.Clicked += OnPauseClicked;
            player.AspectMode = VideoAspectMode.AspectFit;
            CrossMediaManager.Current.Stop();
            player.GestureRecognizers.Add(new TapGestureRecognizer 
            {
                Command = new Command(() => {
                    Debug.WriteLine("May be this was what was wrong ");
                }),
                NumberOfTapsRequired = 1
            });

        }

I am not sure what is it that I am doing wrong here.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
15mgm15commented, Apr 8, 2018

@martijn00 I am having the same issue on latest version, is this by any chance merged?

0reactions
Haza85commented, Oct 8, 2019

Have the same issue in 0.8.11 version

Read more comments on GitHub >

github_iconTop Results From Across the Web

GestureRecognizer attached to VideoView never gets called
I have a simple view to which I am trying to add a gesture recognizer to implement additional functionality. However, the gesture recognizer...
Read more >
swift - UISwipeGestureRecognizer not calling function on ...
I have added a UISwipeGestureRecognizer to the view however when testing, the function attached is not being called. Can anyone see what is ......
Read more >
UIGestureRecognizer | Apple Developer Documentation
Overview. A gesture recognizer decouples the logic for recognizing a sequence of touches (or other input) and acting on that recognition.
Read more >
Can't Get Simultaneous Gesture Recognition to Work
The gestureRecognizer function apparently never gets called by the delegator, but I don't understand why or know how to fix the problem.
Read more >
Detect common gestures
OnGestureListener never get called. This has the potential to cause unexpected problems in your app. The only time you should return false ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found