diff --git a/XamarinTV.Android/MainActivity.cs b/XamarinTV.Android/MainActivity.cs index 1cd670d..2736de2 100644 --- a/XamarinTV.Android/MainActivity.cs +++ b/XamarinTV.Android/MainActivity.cs @@ -27,7 +27,6 @@ namespace XamarinTV.Droid base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); - Forms.SetFlags("IndicatorView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental"); Forms.Init(this, savedInstanceState); CachedImageRenderer.Init(true); SharpnadoInitializer.Initialize(); diff --git a/XamarinTV.UWP/App.xaml.cs b/XamarinTV.UWP/App.xaml.cs index b037b2f..f549a6e 100644 --- a/XamarinTV.UWP/App.xaml.cs +++ b/XamarinTV.UWP/App.xaml.cs @@ -39,7 +39,6 @@ namespace XamarinTV.UWP rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; - Xamarin.Forms.Forms.SetFlags("IndicatorView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental"); Xamarin.Forms.Forms.Init(e); // requires the `e` parameter if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) diff --git a/XamarinTV/App.xaml.cs b/XamarinTV/App.xaml.cs index bc82e36..d9b5d8c 100644 --- a/XamarinTV/App.xaml.cs +++ b/XamarinTV/App.xaml.cs @@ -2,6 +2,7 @@ using Xamarin.Forms.PlatformConfiguration; using Xamarin.Forms.PlatformConfiguration.WindowsSpecific; using FormsApplication = Xamarin.Forms.Application; +using System.Collections.Generic; namespace XamarinTV { @@ -20,8 +21,10 @@ namespace XamarinTV } _mainPage = new MainPage(); - MainPage = _mainPage; - + MainPage = _mainPage; + + Xamarin.Forms.Device.SetFlags(new List() { "StateTriggers_Experimental", "IndicatorView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental" }); + On().SetImageDirectory("Assets"); } diff --git a/XamarinTV/Views/VideoPlayerView.xaml.cs b/XamarinTV/Views/VideoPlayerView.xaml.cs index f00bb3d..d3bd830 100644 --- a/XamarinTV/Views/VideoPlayerView.xaml.cs +++ b/XamarinTV/Views/VideoPlayerView.xaml.cs @@ -44,11 +44,25 @@ namespace XamarinTV.Views } } + bool IsLandscape + { + get + { + if (DualScreenInfo.Current.SpanMode == TwoPaneViewMode.SinglePane && + DualScreenInfo.Current.HingeBounds == Rectangle.Zero) + return Device.info.CurrentOrientation == Xamarin.Forms.Internals.DeviceOrientation.Landscape || + Device.info.CurrentOrientation == Xamarin.Forms.Internals.DeviceOrientation.LandscapeRight || + Device.info.CurrentOrientation == Xamarin.Forms.Internals.DeviceOrientation.LandscapeLeft; + + return DualScreenInfo.Current.IsLandscape; + } + } + void UpdateAspectRatio() { Device.BeginInvokeOnMainThread(() => { - if (DualScreenInfo.Current.IsLandscape) + if (IsLandscape) { VideoPlayer.Aspect = Aspect.AspectFill; VideoPlayer.HeightRequest = -1;