Медленное переключение видео в VideoPlayer (Octane.Xamarin.Forms.VideoPlayer)
У меня есть Octane.Xamarin.Forms.VideoPlayer, при свайпе я должен менять видео в нём на другое, Я это делаю через смену Source у этого плеера, но оно очень долго грузит, с чем это может быть связано?
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:o="clr-namespace:Octane.Xamarin.Forms.VideoPlayer;assembly=Octane.Xamarin.Forms.VideoPlayer"
x:Class="XamarineSwipe.MainPage">
<!--<Label Text="@TEXT" x:Name="textLabel" TextColor="Wheat" FontSize="90" Padding="100,10,30,10"/>-->
<StackLayout>
<o:VideoPlayer x:Name="mediaElement" HeightRequest="200" AutoPlay="True"/>
<StackLayout.GestureRecognizers>
<SwipeGestureRecognizer Direction="Down" Swiped="OnSwipe"/>
<SwipeGestureRecognizer Direction="Up" Swiped="OnSwipe"/>
<SwipeGestureRecognizer Direction="Left" Swiped="OnSwipe"/>
<SwipeGestureRecognizer Direction="Right" Swiped="OnSwipe"/>
</StackLayout.GestureRecognizers>
</StackLayout>
</ContentPage>
void OnSwipe(object sender, SwipedEventArgs e)
{
switch (e.Direction)
{
case SwipeDirection.Down:
Console.WriteLine("DOWn");
ChangeVideo(1);
break;
case SwipeDirection.Up:
Console.WriteLine("UP");
ChangeVideo(-1);
break;
case SwipeDirection.Left:
break;
case SwipeDirection.Right:
break;
}
}
void ChangeVideo(int index)
{
currentIndexVideo += index;
if (currentIndexVideo - 1 > Videos.Count) currentIndexVideo = 0;
else if (currentIndexVideo < 0) currentIndexVideo = Videos.Count-1;
mediaElement.Source = Videos[currentIndexVideo].Url;
//mediaElement.Play();
}