From 7a98d92def1d8d2c715a4840524962d1f568e1fb Mon Sep 17 00:00:00 2001 From: Athul Raj Date: Sat, 8 Jun 2024 22:25:42 +0530 Subject: [PATCH] fix ui scaling when going to watch view --- Totoro.WinUI/App.xaml.cs | 24 ++++++++++++++++++ .../Flyleaf/FlyleafMediaPlayerElement.xaml.cs | 25 ------------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/Totoro.WinUI/App.xaml.cs b/Totoro.WinUI/App.xaml.cs index c1b7bb6..0ed318a 100644 --- a/Totoro.WinUI/App.xaml.cs +++ b/Totoro.WinUI/App.xaml.cs @@ -186,6 +186,7 @@ private void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledEx protected async override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) { + StartFlyleaf(); MainWindow = new MainWindow() { Title = "AppDisplayName".GetLocalized() }; base.OnLaunched(args); RxApp.DefaultExceptionHandler = GetService(); @@ -201,6 +202,29 @@ protected async override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventA App_Activated(actArgs); } + private static void StartFlyleaf() + { + FlyleafLib.Engine.Start(new FlyleafLib.EngineConfig() + { + FFmpegDevices = false, // Prevents loading avdevice/avfilter dll files. Enable it only if you plan to use dshow/gdigrab etc. + +#if RELEASE + FFmpegPath = @"FFmpeg", + FFmpegLogLevel = FFmpegLogLevel.Quiet, + LogLevel = LogLevel.Quiet, + +#else + FFmpegLogLevel = FlyleafLib.FFmpegLogLevel.Warning, + LogLevel = FlyleafLib.LogLevel.Debug, + LogOutput = ":debug", + FFmpegPath = @"E:\FFmpeg", +#endif + UIRefresh = false, // Required for Activity, BufferedDuration, Stats in combination with Config.Player.Stats = true + UIRefreshInterval = 250, // How often (in ms) to notify the UI + UICurTimePerSecond = true, // Whether to notify UI for CurTime only when it's second changed or by UIRefreshInterval + }); + } + private static void ConfigureLogging() { var knownFolders = GetService(); diff --git a/Totoro.WinUI/Media/Flyleaf/FlyleafMediaPlayerElement.xaml.cs b/Totoro.WinUI/Media/Flyleaf/FlyleafMediaPlayerElement.xaml.cs index eee7425..9eae815 100644 --- a/Totoro.WinUI/Media/Flyleaf/FlyleafMediaPlayerElement.xaml.cs +++ b/Totoro.WinUI/Media/Flyleaf/FlyleafMediaPlayerElement.xaml.cs @@ -30,31 +30,6 @@ public FlyleafMediaPlayerElement() ProtectedCursor = InputSystemCursor.Create(InputSystemCursorShape.Arrow); - Engine.Start(new EngineConfig() - { - FFmpegDevices = false, // Prevents loading avdevice/avfilter dll files. Enable it only if you plan to use dshow/gdigrab etc. - -#if RELEASE - FFmpegPath = @"FFmpeg", - FFmpegLogLevel = FFmpegLogLevel.Quiet, - LogLevel = LogLevel.Quiet, - -#else - FFmpegLogLevel = FFmpegLogLevel.Warning, - LogLevel = LogLevel.Debug, - LogOutput = ":debug", - FFmpegPath = @"E:\FFmpeg", - //LogOutput = ":console", - //LogOutput = @"C:\Flyleaf\Logs\flyleaf.log", -#endif - - //PluginsPath = @"C:\Flyleaf\Plugins", - - UIRefresh = false, // Required for Activity, BufferedDuration, Stats in combination with Config.Player.Stats = true - UIRefreshInterval = 250, // How often (in ms) to notify the UI - UICurTimePerSecond = true, // Whether to notify UI for CurTime only when it's second changed or by UIRefreshInterval - }); - _pointerMoved .Throttle(TimeSpan.FromSeconds(3)) .ObserveOn(RxApp.MainThreadScheduler)